Panda3D
|
00001 // Filename: threadPriority.cxx 00002 // Created by: drose (26Sep08) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "threadPriority.h" 00016 00017 ostream & 00018 operator << (ostream &out, ThreadPriority pri) { 00019 switch (pri) { 00020 case TP_low: 00021 return out << "low"; 00022 00023 case TP_normal: 00024 return out << "normal"; 00025 00026 case TP_high: 00027 return out << "high"; 00028 00029 case TP_urgent: 00030 return out << "urgent"; 00031 } 00032 00033 pipeline_cat->error() 00034 << "Invalid ThreadPriority value: " << (int)pri << "\n"; 00035 nassertr(false, out); 00036 return out; 00037 } 00038 00039 istream & 00040 operator >> (istream &in, ThreadPriority &pri) { 00041 string word; 00042 in >> word; 00043 if (word == "low") { 00044 pri = TP_low; 00045 00046 } else if (word == "normal") { 00047 pri = TP_normal; 00048 00049 } else if (word == "high") { 00050 pri = TP_high; 00051 00052 } else if (word == "urgent") { 00053 pri = TP_urgent; 00054 00055 } else { 00056 pri = TP_normal; 00057 pipeline_cat->error() 00058 << "Invalid ThreadPriority string: " << word << "\n"; 00059 nassertr(false, in); 00060 } 00061 00062 return in; 00063 }