Ver Fonte

output() method

David Rose há 23 anos atrás
pai
commit
e04b7aa893
3 ficheiros alterados com 20 adições e 0 exclusões
  1. 6 0
      panda/src/express/thread.I
  2. 10 0
      panda/src/express/thread.cxx
  3. 4 0
      panda/src/express/thread.h

+ 6 - 0
panda/src/express/thread.I

@@ -156,3 +156,9 @@ INLINE void Thread::
 sleep(double seconds) {
 sleep(double seconds) {
   ThreadImpl::sleep(seconds);
   ThreadImpl::sleep(seconds);
 }
 }
+
+INLINE ostream &
+operator << (ostream &out, const Thread &thread) {
+  thread.output(out);
+  return out;
+}

+ 10 - 0
panda/src/express/thread.cxx

@@ -28,3 +28,13 @@ TypeHandle Thread::_type_handle;
 Thread::
 Thread::
 ~Thread() {
 ~Thread() {
 }
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: Thread::Destructor
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void Thread::
+output(ostream &out) const {
+  out << get_type() << " " << get_name();
+}

+ 4 - 0
panda/src/express/thread.h

@@ -61,6 +61,8 @@ public:
   INLINE static bool is_threading_supported();
   INLINE static bool is_threading_supported();
   INLINE static void sleep(double seconds);
   INLINE static void sleep(double seconds);
 
 
+  virtual void output(ostream &out) const;
+
 private:
 private:
   bool _started;
   bool _started;
   string _name;
   string _name;
@@ -82,6 +84,8 @@ private:
   static TypeHandle _type_handle;
   static TypeHandle _type_handle;
 };
 };
 
 
+INLINE ostream &operator << (ostream &out, const Thread &thread);
+
 #include "thread.I"
 #include "thread.I"
 
 
 #endif
 #endif