00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
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 }