Panda3D
Loading...
Searching...
No Matches
threadPriority.cxx
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file threadPriority.cxx
10 * @author drose
11 * @date 2008-09-26
12 */
13
14#include "threadPriority.h"
15#include "pnotify.h" // nassertr
16#include "pipeline.h"
17
18using std::istream;
19using std::ostream;
20using std::string;
21
22ostream &
23operator << (ostream &out, ThreadPriority pri) {
24 switch (pri) {
25 case TP_low:
26 return out << "low";
27
28 case TP_normal:
29 return out << "normal";
30
31 case TP_high:
32 return out << "high";
33
34 case TP_urgent:
35 return out << "urgent";
36 }
37
38 pipeline_cat->error()
39 << "Invalid ThreadPriority value: " << (int)pri << "\n";
40 nassertr(false, out);
41 return out;
42}
43
44istream &
45operator >> (istream &in, ThreadPriority &pri) {
46 string word;
47 in >> word;
48 if (word == "low") {
49 pri = TP_low;
50
51 } else if (word == "normal") {
52 pri = TP_normal;
53
54 } else if (word == "high") {
55 pri = TP_high;
56
57 } else if (word == "urgent") {
58 pri = TP_urgent;
59
60 } else {
61 pri = TP_normal;
62 pipeline_cat->error()
63 << "Invalid ThreadPriority string: " << word << "\n";
64 nassertr(false, in);
65 }
66
67 return in;
68}
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.