Bladeren bron

Expose DatagramOutputFile to Python, add props to DatagramSink

rdb 8 jaren geleden
bovenliggende
commit
35349b6224
2 gewijzigde bestanden met toevoegingen van 11 en 2 verwijderingen
  1. 4 0
      panda/src/express/datagramSink.h
  2. 7 2
      panda/src/putil/datagramOutputFile.h

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

@@ -40,6 +40,10 @@ PUBLISHED:
   virtual const Filename &get_filename();
   virtual const FileReference *get_file();
   virtual streampos get_file_pos();
+
+  MAKE_PROPERTY(filename, get_filename);
+  MAKE_PROPERTY(file, get_file);
+  MAKE_PROPERTY(file_pos, get_file_pos);
 };
 
 #include "datagramSink.I"

+ 7 - 2
panda/src/putil/datagramOutputFile.h

@@ -28,14 +28,13 @@
  * header followed by a number of datagrams.
  */
 class EXPCL_PANDA_PUTIL DatagramOutputFile : public DatagramSink {
-public:
+PUBLISHED:
   INLINE DatagramOutputFile();
   INLINE ~DatagramOutputFile();
 
   bool open(const FileReference *file);
   INLINE bool open(const Filename &filename);
   bool open(ostream &out, const Filename &filename = Filename());
-  INLINE ostream &get_stream();
 
   void close();
 
@@ -46,10 +45,16 @@ public:
   virtual bool is_error();
   virtual void flush();
 
+public:
   virtual const Filename &get_filename();
   virtual const FileReference *get_file();
   virtual streampos get_file_pos();
 
+  INLINE ostream &get_stream();
+
+PUBLISHED:
+  MAKE_PROPERTY(stream, get_stream);
+
 private:
   bool _wrote_first_datagram;
   bool _error;