⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 object.h

📁 mgcp协议源代码。支持多种编码:g711
💻 H
📖 第 1 页 / 共 5 页
字号:
    virtual PUnSerialiser & operator>>(char *) = 0;    /// Input primitive from stream.    virtual PUnSerialiser & operator>>(unsigned char *) = 0;    /// Input primitive from stream.    virtual PUnSerialiser & operator>>(signed char *) = 0;    /** Input the data from the un-serialiser object.      When the operator is executed on a #PObject# descendent then      that objects #PObject::UnSerialise()# function is called.     */    virtual PUnSerialiser & operator>>(PObject &) = 0;  protected:    /// Stream the read un-serialiser data from.    istream & stream;};/**Declare information in a class for serialisation of objects.   This macro is used to declare functions required by the serialisation   system. It is used in conjunction with the #PIMPLEMENT_SERIAL# macro.   This declares the #PObject::PreSerialise()# and   #PObject::Serialise()# functions which must be imeplemented by the   user. The un-serialisation and registration is declared and implemented by   these two functions automatically. */#define PSERIALINFO(cls) \  public: \    virtual PINDEX PreSerialise(PSerialiser & strm); \    virtual void Serialise(PSerialiser & serial); \    virtual void UnSerialise(PUnSerialiser & serial); \  protected: \    cls(PUnSerialiser & serial); \    static cls * UnSerialiseNew(PUnSerialiser & serial); \  private: \    PINDEX serialisedLength; \    static PSerialRegistration pRegisterSerial; \/**   This macro is used to implement functions required by the serialisation   system. It is used in conjunction with the #PDECLARE_SERIAL# macro. */#define PIMPLEMENT_SERIAL(cls) \  cls * cls::UnSerialiseNew(PUnSerialiser & serial) \    { return new cls(serial); } \  PSerialRegistration cls::pRegisterSerial(cls::Class(), cls::UnSerialise); \/** This serialiser class serialises each object using ASCII text. This gives  the highest level of portability for streams and platforms at the expense  if larger amounts of data. */class PTextSerialiser : public PSerialiser{  PCLASSINFO(PTextSerialiser, PSerialiser);  public:    /// Create a text serialiser.    PTextSerialiser(      ostream & strm,   // Stream to serialise to.      PObject & data    // First object to serialise.    );    /// Output primitive to stream.    PSerialiser & operator<<(char);    /// Output primitive to stream.    PSerialiser & operator<<(unsigned char);    /// Output primitive to stream.    PSerialiser & operator<<(signed char);    /// Output primitive to stream.    PSerialiser & operator<<(short);    /// Output primitive to stream.    PSerialiser & operator<<(unsigned short);    /// Output primitive to stream.    PSerialiser & operator<<(int);    /// Output primitive to stream.    PSerialiser & operator<<(unsigned int);    /// Output primitive to stream.    PSerialiser & operator<<(long);    /// Output primitive to stream.    PSerialiser & operator<<(unsigned long);    /// Output primitive to stream.    PSerialiser & operator<<(float);    /// Output primitive to stream.    PSerialiser & operator<<(double);    /// Output primitive to stream.    PSerialiser & operator<<(long double);    /// Output primitive to stream.    PSerialiser & operator<<(const char *);    /// Output primitive to stream.    PSerialiser & operator<<(const unsigned char *);    /// Output primitive to stream.    PSerialiser & operator<<(const signed char *);    /** Output the data to the serialiser object.      When the operator is executed on a #PObject# descendent then that objects      #PObject::Serialise()# function is called.     */    virtual PSerialiser & operator<<(PObject & obj);};class PSortedStringList;/** This serialiser class serialises each object using binary data. This gives   the highest level data density at the expense of some portability and   possibly the speed of execution.      This is because two passes through the objects is made, the first to   determine the classes and sizes and the second to actually output the data.   A table of classes must also be output to set the correspondence between   the class codes used in the output and the class names that are required by   the unserialiser to construct instances of those classes. */class PBinarySerialiser : public PSerialiser{  PCLASSINFO(PBinarySerialiser, PSerialiser);  public:    /// Create a binary serialiser.    PBinarySerialiser(      ostream & strm,   // Stream to serialise to.      PObject & data    // First object to serialise.    );    /// Destroy the serialiser and its class table.    ~PBinarySerialiser();    /// Output primitive to stream.    PSerialiser & operator<<(char);    /// Output primitive to stream.    PSerialiser & operator<<(unsigned char);    /// Output primitive to stream.    PSerialiser & operator<<(signed char);    /// Output primitive to stream.    PSerialiser & operator<<(short);    /// Output primitive to stream.    PSerialiser & operator<<(unsigned short);    /// Output primitive to stream.    PSerialiser & operator<<(int);    /// Output primitive to stream.    PSerialiser & operator<<(unsigned int);    /// Output primitive to stream.    PSerialiser & operator<<(long);    /// Output primitive to stream.    PSerialiser & operator<<(unsigned long);    /// Output primitive to stream.    PSerialiser & operator<<(float);    /// Output primitive to stream.    PSerialiser & operator<<(double);    /// Output primitive to stream.    PSerialiser & operator<<(long double);    /// Output primitive to stream.    PSerialiser & operator<<(const char *);    /// Output primitive to stream.    PSerialiser & operator<<(const unsigned char *);    /// Output primitive to stream.    PSerialiser & operator<<(const signed char *);    /** Output the data to the serialiser object.      When the operator is executed on a #PObject# descendent then that objects      #PObject::Serialise()# function is called.     */    virtual PSerialiser & operator<<(PObject & obj);  protected:    /// List of classes used during serialisation.    PSortedStringList * classesUsed;};/** This un-serialiser class reconstructs each object using ASCII text. This   gives the highest level of portability for streams and platforms at the   expense if larger amounts of data. */class PTextUnSerialiser : public PUnSerialiser{  PCLASSINFO(PTextUnSerialiser, PUnSerialiser);  public:    /// Create a text un-serialiser.    PTextUnSerialiser(      istream & strm    // Stream to read serialised objects from.    );    /// Input primitive from stream.    PUnSerialiser & operator>>(char &);    /// Input primitive from stream.    PUnSerialiser & operator>>(unsigned char &);    /// Input primitive from stream.    PUnSerialiser & operator>>(signed char &);    /// Input primitive from stream.    PUnSerialiser & operator>>(short &);    /// Input primitive from stream.    PUnSerialiser & operator>>(unsigned short &);    /// Input primitive from stream.    PUnSerialiser & operator>>(int &);    /// Input primitive from stream.    PUnSerialiser & operator>>(unsigned int &);    /// Input primitive from stream.    PUnSerialiser & operator>>(long &);    /// Input primitive from stream.    PUnSerialiser & operator>>(unsigned long &);    /// Input primitive from stream.    PUnSerialiser & operator>>(float &);    /// Input primitive from stream.    PUnSerialiser & operator>>(double &);    /// Input primitive from stream.    PUnSerialiser & operator>>(long double &);    /// Input primitive from stream.    PUnSerialiser & operator>>(char *);    /// Input primitive from stream.    PUnSerialiser & operator>>(unsigned char *);    /// Input primitive from stream.    PUnSerialiser & operator>>(signed char *);    /** Input the data from the un-serialiser object.      When the operator is executed on a #PObject# descendent then      that objects #PObject::UnSerialise()# function is called.     */    PUnSerialiser & operator>>(PObject &);};class PStringArray;/** This un-serialiser class reconstructs each object using binary data. This   gives the highest level data density at the expense of some portability and   possibly the speed of execution.      A table of classes must also be output   to set the correspondence between the class codes used in the output and   the class names that are required by the unserialiser to construct instances   of those classes. */class PBinaryUnSerialiser : public PUnSerialiser{  PCLASSINFO(PBinaryUnSerialiser, PUnSerialiser);  public:    /// Create a binary un-serialiser.    PBinaryUnSerialiser(      istream & strm    // Stream to read serialised objects from.    );    /// Destroy the un-serialiser and its class table.    ~PBinaryUnSerialiser();    /// Input primitive from stream.    PUnSerialiser & operator>>(char &);    /// Input primitive from stream.    PUnSerialiser & operator>>(unsigned char &);    /// Input primitive from stream.    PUnSerialiser & operator>>(signed char &);    /// Input primitive from stream.    PUnSerialiser & operator>>(short &);    /// Input primitive from stream.    PUnSerialiser & operator>>(unsigned short &);    /// Input primitive from stream.    PUnSerialiser & operator>>(int &);    /// Input primitive from stream.    PUnSerialiser & operator>>(unsigned int &);    /// Input primitive from stream.    PUnSerialiser & operator>>(long &);    /// Input primitive from stream.    PUnSerialiser & operator>>(unsigned long &);    /// Input primitive from stream.    PUnSerialiser & operator>>(float &);    /// Input primitive from stream.    PUnSerialiser & operator>>(double &);    /// Input primitive from stream.    PUnSerialiser & operator>>(long double &);    /// Input primitive from stream.    PUnSerialiser & operator>>(char *);    /// Input primitive from stream.    PUnSerialiser & operator>>(unsigned char *);    /// Input primitive from stream.    PUnSerialiser & operator>>(signed char *);    /** Input the data from the un-serialiser object.      When the operator is executed on a #PObject# descendent then      that objects #PObject::UnSerialise()# function is called.     */    PUnSerialiser & operator>>(PObject &);  protected:    /// Class table used by the serialiser.    PStringArray * classesUsed;};///////////////////////////////////////////////////////////////////////////////// "Smart" pointers./** This is the base class for objects that use the {\it smart pointer} system.   In conjunction with the #PSmartPointer# class, this class creates   objects that can have the automatic deletion of the object instance when   there are no more smart pointer instances pointing to it.   A #PSmartObject# carries the reference count that the #PSmartPointer#    requires to determine if the pointer is needed any more and should be   deleted. */class PSmartObject : public PObject{  PCLASSINFO(PSmartObject, PObject);  public:    /** Construct a new smart object, subject to a #PSmartPointer# instance       referencing it.     */    PSmartObject() { referenceCount = 1; }  protected:    /** Count of number of instances of #PSmartPointer# that currently       reference the object instance.     */    unsigned referenceCount;  friend class PSmartPointer;};/** This is the class for pointers to objects that use the {\it smart pointer}   system. In conjunction with the #PSmartObject# class, this class   references objects that can have the automatic deletion of the object   instance when there are no more smart pointer instances pointing to it.   A PSmartPointer carries the pointer to a #PSmartObject# instance which   contains a reference count. Assigning or copying instances of smart pointers   will automatically increment and decrement the reference count. When the   last instance that references a #PSmartObject# instance is destroyed or   overwritten, the #PSmartObject# is deleted.   A NULL value is possible for a smart pointer. It can be detected via the   #IsNULL()# function. */class PSmartPointer : public PObject{  PCLASSINFO(PSmartPointer, PObject);  public:  /**@name Construction */  //@{    /** Create a new smart pointer instance and have it point to the specified       #PSmartObject# instance.     */    PSmartPointer(      PSmartObject * obj = NULL   /// Smart object to point to.    ) { object = obj; }    /** Create a new smart pointer and point it at the data pointed to by the       #ptr# parameter. The reference count for the object being       pointed at is incremented.     */    PSmartPointer(      const PSmartPointer & ptr  /// Smart pointer to make a copy of.    );    /** Destroy the smart pointer and decrement the reference count on the       object being pointed to. If there are no more references then the       object is deleted.     */    virtual ~PSmartPointer();    /** Assign this pointer to the value specified in the #ptr#       parameter.       The previous object being pointed to has 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -