8#if !defined(OWL_OBJSTRM_H)
12#if defined(BI_HAS_PRAGMA_ONCE)
45 class TStreamableClass *t;
49 extern TStreamableClass s; \
50 static fLink force ## s = \
51 { (fLink *)&force ## s, (TStreamableClass *)&s };
78#define _OBJ_FULLTYPENAME(obj) typeid(*obj).name()
79#if defined(BI_COMP_MSC) && !defined(UNIX) && !defined(__EDG__)
80# if defined(BI_COMPATIBLE_STREAMING)
81# define _OBJ_TYPENAME(obj) typeid(*obj).name() + 6
83# define _OBJ_TYPENAME(obj) typeid(*obj).raw_name()
86# define _OBJ_TYPENAME(obj) typeid(*obj).name()
151 virtual LPCSTR StreamableName()
const = 0;
167 virtual uint32 ClassVersion()
const = 0;
213 virtual uint32 ClassVersion()
const
232 const auto p = GetObject();
251class TSortedTPWObjObjectArray;
266 Address(
adr), Ident(id) {}
269 {
return reinterpret_cast<TAddrInt>(Address) ==
reinterpret_cast<TAddrInt>(
o.Address); }
272 {
return reinterpret_cast<TAddrInt>(Address) <
reinterpret_cast<TAddrInt>(
o.Address); }
293 TSortedTPWObjObjectArray* Data;
309class TStreamableBaseArray;
324 TStreamableBaseArray* Data;
346 void clear(
int = 0 );
347 operator void *()
const;
350 std::streambuf * rdbuf()
const;
359 void init( std::streambuf * );
360 void setstate(
int );
397 std::streampos tellg();
402 void readBytes(
void *,
size_t );
403 void freadBytes(
void *
data,
size_t sz );
411 char * freadString();
412 char * freadString(
char *buf,
432 uint32 getVersion()
const;
453 uint32 readStringLength();
486 std::streampos tellp();
491 void writeByte(
uint8 );
492 void writeBytes(
const void *,
size_t );
493 void fwriteBytes(
const void *
data,
size_t sz );
496 void writeWord16(
uint16 );
497 void writeWord32(
uint32 );
499 void writeString(
const char * );
500 void fwriteString(
const char * str );
551 enum { openprot = 0666 };
556 void open(
LPCSTR,
int,
int = openprot );
557 void open(
LPCWSTR,
int,
int = openprot );
560 void setbuf(
LPSTR,
int );
561 std::filebuf * rdbuf();
580 int = fpbase::openprot
584 int = fpbase::openprot
587 std::filebuf * rdbuf();
591 int = fpbase::openprot
595 int = fpbase::openprot
611 int = fpbase::openprot
615 int = fpbase::openprot
618 std::filebuf * rdbuf();
622 int = fpbase::openprot
626 int = fpbase::openprot
651 return state & std::ios::eofbit;
656 return state & (std::ios::failbit | std::ios::badbit | std::ios::goodbit);
661 return state & (std::ios::badbit | std::ios::goodbit);
676inline pstream::operator
void *()
const {
677 return fail() ? 0 : (
void *)
this;
723 return objs.Find(
id );
728 objs.RegisterObject(
adr );
753 return objs->FindObject(
adr );
758 objs->RegisterObject(
adr );
763 return objs->FindVB(
adr );
768 objs->RegisterVB(
adr );
928 sh =
ps.readWord16();
938 sh =
ps.readWord16();
958 i = (
unsigned int)(
ps.readWord());
968 ps.readBytes( &
l,
sizeof(
l) );
978 ps.readBytes( &
l,
sizeof(
l) );
984 ps.readBytes(&
v,
sizeof v);
990 ps.readBytes(&
v,
sizeof v);
1000 ps.readBytes( &f,
sizeof(f) );
1010 ps.readBytes( &
d,
sizeof(
d) );
1020 ps.readBytes( &
l,
sizeof(
l) );
1030 b =
static_cast<bool>(
ps.readWord32());
1062 ps.writeWord16(
sh );
1070 ps.writeWord16(
sh );
1078 ps.writeWord32(
i );
1086 ps.writeWord32(
i );
1094 ps.writeBytes( &
l,
sizeof(
l) );
1102 ps.writeBytes( &
l,
sizeof(
l) );
1108 ps.writeBytes(&
v,
sizeof v);
1114 ps.writeBytes(&
v,
sizeof v);
1122 ps.writeBytes( &f,
sizeof(f) );
1130 ps.writeBytes( &
d,
sizeof(
d) );
1138 ps.writeBytes( &
l,
sizeof(
l) );
1146 ps.writeWord32(
b );
1164 if(
in.getVersion() > 0 )
1175 if(
out.findVB( base ) != 0 ){
1185 out.writeWord32(
strmr.ClassVersion() );
1201 if(
in.getVersion() > 0 )
1202 ver =
in.readWord32();
1205 in.registerObject(
strmr.GetObject());
1216#if defined(__clang__)
1217#define READBASEOBJECT(cls) ReadBaseObject<cls>( cls *, ::owl::ipstream& )
1218#define WRITEBASEOBJECT(cls) WriteBaseObject<cls>( cls *, ::owl::opstream& )
1219#define READVIRTUALBASE(cls) ReadVirtualBase<cls>( cls *, ::owl::ipstream& )
1220#define WRITEVIRTUALBASE(cls) WriteVirtualBase<cls>( cls *, ::owl::opstream& )
1222#define READBASEOBJECT(cls) ReadBaseObject( cls *, ::owl::ipstream& )
1223#define WRITEBASEOBJECT(cls) WriteBaseObject( cls *, ::owl::opstream& )
1224#define READVIRTUALBASE(cls) ReadVirtualBase( cls *, ::owl::ipstream& )
1225#define WRITEVIRTUALBASE(cls) WriteVirtualBase( cls *, ::owl::opstream& )
1230#define DECLARE_STREAMERS(cls, ver ) \
1232 class Streamer : public ::owl::TNewStreamer \
1236 Streamer( ::owl::TStreamableBase *obj ); \
1238 virtual ::owl::uint32 ClassVersion() const \
1241 virtual void Write( ::owl::opstream& ) const; \
1242 virtual void *Read( ::owl::ipstream&, ::owl::uint32 ) const; \
1244 cls *GetObject() const \
1249 static ::owl::TStreamer *Build( ::owl::TStreamableBase *obj ) \
1251 return new Streamer( obj ? obj : new cls(::owl::streamableInit) ); \
1258 friend class Streamer; \
1259 friend void ::owl:: READBASEOBJECT( cls ); \
1260 friend void ::owl:: WRITEBASEOBJECT( cls );\
1261 friend void ::owl:: READVIRTUALBASE( cls );\
1262 friend void ::owl:: WRITEVIRTUALBASE( cls )
1265#define DECLARE_STREAMER( exp, cls, ver ) \
1267 class exp Streamer : public ::owl::TNewStreamer \
1271 Streamer( ::owl::TStreamableBase *obj ); \
1273 virtual ::owl::uint32 ClassVersion() const \
1276 virtual void Write( ::owl::opstream& ) const; \
1277 virtual void *Read( ::owl::ipstream&, ::owl::uint32 ) const; \
1279 cls *GetObject() const \
1284 static ::owl::TStreamer *Build( ::owl::TStreamableBase *obj ) \
1286 return new Streamer( obj ? obj : new cls(::owl::streamableInit) ); \
1293 friend class exp Streamer; \
1294 friend void ::owl:: READBASEOBJECT( cls ); \
1295 friend void ::owl:: WRITEBASEOBJECT( cls ); \
1296 friend void ::owl:: READVIRTUALBASE( cls ); \
1297 friend void ::owl:: WRITEVIRTUALBASE( cls )
1300#define DECLARE_STREAMER_FROM_BASES(cls, base ) \
1302 class Streamer : public base::Streamer \
1306 Streamer( ::owl::TStreamableBase *obj ) : base::Streamer(obj){} \
1308 cls *GetObject() const \
1313 static ::owl::TStreamer *Build( ::owl::TStreamableBase *obj ) \
1315 return new Streamer( obj ? obj : new cls(::owl::streamableInit) ); \
1322 friend class Streamer; \
1323 friend void ::owl:: READBASEOBJECT( cls ); \
1324 friend void ::owl:: WRITEBASEOBJECT( cls ); \
1325 friend void ::owl:: READVIRTUALBASE( cls ); \
1326 friend void ::owl:: WRITEVIRTUALBASE( cls )
1329#define DECLARE_STREAMER_FROM_BASE( exp, cls, base ) \
1331 class exp Streamer : public base::Streamer \
1335 Streamer( ::owl::TStreamableBase *obj ) : base::Streamer(obj){} \
1337 cls *GetObject() const \
1342 static ::owl::TStreamer *Build( ::owl::TStreamableBase *obj ) \
1344 return new Streamer( obj ? obj : new cls(::owl::streamableInit) ); \
1351 friend class exp Streamer; \
1352 friend void ::owl:: READBASEOBJECT( cls ); \
1353 friend void ::owl:: WRITEBASEOBJECT( cls );\
1354 friend void ::owl:: READVIRTUALBASE( cls );\
1355 friend void ::owl:: WRITEVIRTUALBASE( cls )
1357#define DECLARE_ABSTRACT_STREAMERS(cls, ver ) \
1359 class Streamer : public ::owl::TNewStreamer \
1363 Streamer( ::owl::TStreamableBase *obj ); \
1365 virtual ::owl::uint32 ClassVersion() const \
1368 virtual void Write( ::owl::opstream& ) const; \
1369 virtual void *Read( ::owl::ipstream&, ::owl::uint32 ) const; \
1371 cls *GetObject() const \
1380 friend class Streamer; \
1381 friend void ::owl:: READBASEOBJECT( cls ); \
1382 friend void ::owl:: WRITEBASEOBJECT( cls );\
1383 friend void ::owl:: READVIRTUALBASE( cls );\
1384 friend void ::owl:: WRITEVIRTUALBASE( cls )
1386#define DECLARE_ABSTRACT_STREAMER( exp, cls, ver ) \
1388 class exp Streamer : public ::owl::TNewStreamer \
1392 Streamer( ::owl::TStreamableBase *obj ); \
1394 virtual ::owl::uint32 ClassVersion() const \
1397 virtual void Write( ::owl::opstream& ) const; \
1398 virtual void *Read( ::owl::ipstream&, ::owl::uint32 ) const; \
1400 cls *GetObject() const \
1409 friend class exp Streamer; \
1410 friend void ::owl:: READBASEOBJECT( cls ); \
1411 friend void ::owl:: WRITEBASEOBJECT( cls );\
1412 friend void ::owl:: READVIRTUALBASE( cls );\
1413 friend void ::owl:: WRITEVIRTUALBASE( cls )
1416#define DECLARE_STREAMABLE_OPS( cls ) \
1417static ::owl::ipstream& readRef( ::owl::ipstream& is, cls& cl ); \
1418friend inline ::owl::ipstream& operator >> ( ::owl::ipstream& is, cls& cl ) \
1419 { return cls::readRef( is, cl ); } \
1420static ::owl::ipstream& readPtr( ::owl::ipstream& is, cls*& cl ); \
1421friend inline ::owl::ipstream& operator >> ( ::owl::ipstream& is, cls*& cl ) \
1422 { return cls::readPtr( is, cl ); } \
1423static ::owl::opstream& writeRef( ::owl::opstream& is, const cls& cl ); \
1424friend inline ::owl::opstream& operator << ( ::owl::opstream& os, const cls& cl ) \
1425 { return cls::writeRef( os, cl ); } \
1426static ::owl::opstream& writePtr( ::owl::opstream& is, const cls* cl ); \
1427friend inline ::owl::opstream& operator << ( ::owl::opstream& os, const cls* cl ) \
1428 { return cls::writePtr( os, cl ); }
1430#define DECLARE_STREAMABLE_INLINES_I( cls )
1433#define DECLARE_STREAMABLE_CTOR( cls ) \
1435 cls ( ::owl::StreamableInit )
1440# define DECLARE_CASTABLE friend class std::type_info
1445#if OWL_PERSISTENT_STREAMS
1447#define DECLARE_STREAMABLE( exp, cls, ver ) \
1448 DECLARE_CASTABLE ; \
1449 DECLARE_STREAMER( exp, cls, ver ); \
1450 DECLARE_STREAMABLE_OPS( cls ); \
1451 DECLARE_STREAMABLE_CTOR( cls )
1453#define DECLARE_STREAMABLES(cls, ver ) \
1454 DECLARE_CASTABLE ; \
1455 DECLARE_STREAMERS(cls, ver ); \
1456 DECLARE_STREAMABLE_OPS( cls ); \
1457 DECLARE_STREAMABLE_CTOR( cls )
1459#define DECLARE_STREAMABLE_FROM_BASE( exp, cls, base ) \
1461 DECLARE_STREAMER_FROM_BASE( exp, cls, base ); \
1462 DECLARE_STREAMABLE_OPS( cls ); \
1463 DECLARE_STREAMABLE_CTOR( cls )
1465#define DECLARE_STREAMABLE_FROM_BASES(cls, base ) \
1467 DECLARE_STREAMER_FROM_BASES(cls, base ); \
1468 DECLARE_STREAMABLE_OPS( cls ); \
1469 DECLARE_STREAMABLE_CTOR( cls )
1471#define DECLARE_ABSTRACT_STREAMABLE( exp, cls, ver ) \
1473 DECLARE_ABSTRACT_STREAMER( exp, cls, ver ); \
1474 DECLARE_STREAMABLE_OPS( cls ); \
1475 DECLARE_STREAMABLE_CTOR( cls )
1477#define DECLARE_ABSTRACT_STREAMABLES(cls, ver ) \
1479 DECLARE_ABSTRACT_STREAMERS(cls, ver ); \
1480 DECLARE_STREAMABLE_OPS( cls ); \
1481 DECLARE_STREAMABLE_CTOR( cls )
1484#if defined(_BUILDOWLDLL) || defined(_OWLDLL)
1485# define DECLARE_STREAMABLE_OWL( cls, ver ) \
1486 DECLARE_STREAMABLE( _OWLCLASS, cls, ver )
1487# define DECLARE_STREAMABLE_FROM_BASE_OWL( cls, base ) \
1488 DECLARE_STREAMABLE_FROM_BASE( _OWLCLASS, cls, base )
1489#define DECLARE_ABSTRACT_STREAMABLE_OWL(cls, ver ) \
1490 DECLARE_ABSTRACT_STREAMABLE( _OWLCLASS, cls, ver )
1492#define DECLARE_STREAMABLE_INLINES( cls ) \
1493 DECLARE_STREAMABLE_INLINES_I( cls )
1496# define DECLARE_STREAMABLE_OWL(cls, ver ) \
1497 DECLARE_STREAMABLES( cls, ver )
1498# define DECLARE_STREAMABLE_FROM_BASE_OWL( cls, base ) \
1499 DECLARE_STREAMABLE_FROM_BASES(cls, base )
1500#define DECLARE_ABSTRACT_STREAMABLE_OWL(cls, ver ) \
1501 DECLARE_ABSTRACT_STREAMABLES(cls, ver )
1503#define DECLARE_STREAMABLE_INLINES( cls ) \
1504 DECLARE_STREAMABLE_INLINES_I( cls )
1511#define DECLARE_STREAMABLE( exp, cls, ver ) \
1514#define DECLARE_STREAMABLE_S(cls, ver ) \
1517#define DECLARE_STREAMABLE_FROM_BASE( exp, cls, base ) \
1520#define DECLARE_STREAMABLE_FROM_BASE_S( cls, base ) \
1523#define DECLARE_ABSTRACT_STREAMABLE( exp, cls, ver ) \
1526#define DECLARE_ABSTRACT_STREAMABLE_S( cls, ver ) \
1529#define DECLARE_STREAMABLE_OWL(cls, ver ) \
1532# define DECLARE_STREAMABLE_FROM_BASE_OWL( cls, base ) \
1535#define DECLARE_ABSTRACT_STREAMABLE_OWL( cls, ver ) \
1538#define DECLARE_STREAMABLE_INLINES( cls )
1547#define IMPLEMENT_CASTABLE( cls )
1548#define IMPLEMENT_CASTABLE1( cls, base1 )
1549#define IMPLEMENT_CASTABLE2( cls, base1, base2 )
1550#define IMPLEMENT_CASTABLE3( cls, base1, base2, base3 )
1551#define IMPLEMENT_CASTABLE4( cls, base1, base2, base3, base4 )
1552#define IMPLEMENT_CASTABLE5( cls, base1, base2, base3, base4, base5 )
1559#if OWL_PERSISTENT_STREAMS
1560# if defined(BI_COMP_MSC) && !defined(UNIX) && !defined(__EDG__)
1561# if defined(BI_COMPATIBLE_STREAMING)
1562# define IMPLEMENT_STREAMABLE_CLASS( cls ) \
1563 ::owl::TStreamableClass r ## cls( typeid(cls).name() + 6, &cls::Streamer::Build )
1565# define IMPLEMENT_STREAMABLE_CLASS( cls ) \
1566 ::owl::TStreamableClass r ## cls( typeid(cls).raw_name(), &cls::Streamer::Build )
1569# define IMPLEMENT_STREAMABLE_CLASS( cls ) \
1570 ::owl::TStreamableClass r ## cls( typeid(cls).name(), &cls::Streamer::Build )
1573# define IMPLEMENT_STREAMABLE_CLASS( cls )
1576#if OWL_PERSISTENT_STREAMS
1578#define IMPLEMENT_STREAMABLE_POINTER_IMPL(template_prefix, cls)\
1579 template_prefix owl::ipstream& cls::readPtr(::owl::ipstream& is, cls*& cl)\
1580 {::owl::TStreamableBase *t = 0; cl = dynamic_cast<cls*>(is.readObjectPointer(t)); return is;}\
1582 template_prefix owl::ipstream& cls::readRef(::owl::ipstream& is, cls& cl)\
1583 {::owl::TStreamableBase* p = &cl; is.readObject(p); return is;}\
1585 template_prefix owl::opstream& cls::writeRef(::owl::opstream& os, const cls& cl)\
1586 {os.writeObject(&cl); return os;}\
1588 template_prefix owl::opstream& cls::writePtr(::owl::opstream& os, const cls* cl)\
1589 {os.writeObjectPointer(cl); return os;}
1591#define IMPLEMENT_STREAMABLE_POINTER(cls)\
1592 IMPLEMENT_STREAMABLE_POINTER_IMPL(, cls)
1595#define IMPLEMENT_STREAMABLE_POINTER_IMPL(template_prefix, cls)
1596#define IMPLEMENT_STREAMABLE_POINTER( cls )
1599#if OWL_PERSISTENT_STREAMS
1601#define IMPLEMENT_STREAMER( cls ) \
1602cls::Streamer::Streamer( ::owl::TStreamableBase *obj ) : \
1603 ::owl::TNewStreamer(obj), object(TYPESAFE_DOWNCAST(obj,cls)){}
1605#define IMPLEMENT_STREAMABLE_CTOR( cls ) \
1606cls::cls ( ::owl::StreamableInit ) {}
1608#define IMPLEMENT_STREAMABLE_CTOR1_IMPL(template_prefix, cls, constructor, base1)\
1609 template_prefix cls::constructor(::owl::StreamableInit) : base1(::owl::streamableInit) {}
1611#define IMPLEMENT_STREAMABLE_CTOR1(cls, base1)\
1612 IMPLEMENT_STREAMABLE_CTOR1_IMPL(, cls, cls, base1)
1614#define IMPLEMENT_STREAMABLE_CTOR2( cls, base1, base2 ) \
1615cls::cls ( ::owl::StreamableInit ) : \
1616 base1 ( ::owl::streamableInit ), \
1617 base2 ( ::owl::streamableInit ) {}
1619#define IMPLEMENT_STREAMABLE_CTOR3( cls, base1, base2, base3 ) \
1620cls::cls ( ::owl::StreamableInit ) : \
1621 base1 ( ::owl::streamableInit ), \
1622 base2 ( ::owl::streamableInit ), \
1623 base3 ( ::owl::streamableInit ) {}
1625#define IMPLEMENT_STREAMABLE_CTOR4( cls, base1, base2, base3, base4 )\
1626cls::cls ( ::owl::StreamableInit ) : \
1627 base1 ( ::owl::streamableInit ), \
1628 base2 ( ::owl::streamableInit ), \
1629 base3 ( ::owl::streamableInit ), \
1630 base4 ( ::owl::streamableInit ) {}
1632#define IMPLEMENT_STREAMABLE_CTOR5( cls, base1,base2,base3,base4,base5)\
1633cls::cls ( ::owl::StreamableInit ) : \
1634 base1 ( ::owl::streamableInit ), \
1635 base2 ( ::owl::streamableInit ), \
1636 base3 ( ::owl::streamableInit ), \
1637 base4 ( ::owl::streamableInit ), \
1638 base5 ( ::owl::streamableInit ) {}
1641# define IMPLEMENT_STREAMER( cls )
1642# define IMPLEMENT_STREAMABLE_CTOR( cls )
1643# define IMPLEMENT_STREAMABLE_CTOR1_IMPL(template_prefix, cls, constructor, base1)
1644# define IMPLEMENT_STREAMABLE_CTOR1( cls, base1 )
1645# define IMPLEMENT_STREAMABLE_CTOR2( cls, base1, base2 )
1646# define IMPLEMENT_STREAMABLE_CTOR3( cls, base1, base2, base3 )
1647# define IMPLEMENT_STREAMABLE_CTOR4( cls, base1, base2, base3, base4 )
1648# define IMPLEMENT_STREAMABLE_CTOR5( cls, base1,base2,base3,base4,base5)
1656#if OWL_PERSISTENT_STREAMS
1657#define IMPLEMENT_ABSTRACT_STREAMABLE( cls ) \
1658IMPLEMENT_STREAMER( cls ); \
1659IMPLEMENT_STREAMABLE_CTOR( cls ); \
1660IMPLEMENT_STREAMABLE_POINTER( cls )
1662#define IMPLEMENT_ABSTRACT_STREAMABLE1( cls, base1 ) \
1663IMPLEMENT_STREAMER( cls ); \
1664IMPLEMENT_STREAMABLE_CTOR1( cls, base1 ); \
1665IMPLEMENT_STREAMABLE_POINTER( cls )
1667#define IMPLEMENT_ABSTRACT_STREAMABLE2( cls, base1, base2 ) \
1668IMPLEMENT_STREAMER( cls ); \
1669IMPLEMENT_STREAMABLE_CTOR2( cls, base1, base2 ); \
1670IMPLEMENT_STREAMABLE_POINTER( cls )
1672#define IMPLEMENT_ABSTRACT_STREAMABLE3( cls, base1, base2, base3 ) \
1673IMPLEMENT_STREAMER( cls ); \
1674IMPLEMENT_STREAMABLE_CTOR3( cls, base1, base2, base3 ); \
1675IMPLEMENT_STREAMABLE_POINTER( cls )
1677#define IMPLEMENT_ABSTRACT_STREAMABLE4( cls, base1, base2, base3, base4 )\
1678IMPLEMENT_STREAMER( cls ); \
1679IMPLEMENT_STREAMABLE_CTOR4( cls, base1, base2, base3, base4 ); \
1680IMPLEMENT_STREAMABLE_POINTER( cls )
1682#define IMPLEMENT_ABSTRACT_STREAMABLE5( cls, base1, base2, base3, base4, base5 )\
1683IMPLEMENT_STREAMER( cls ); \
1684IMPLEMENT_STREAMABLE_CTOR5( cls, base1, base2, base3, base4, base5 );\
1685IMPLEMENT_STREAMABLE_POINTER( cls )
1687#define IMPLEMENT_STREAMABLE( cls ) \
1688IMPLEMENT_STREAMABLE_CLASS( cls ); \
1689IMPLEMENT_ABSTRACT_STREAMABLE( cls )
1691#define IMPLEMENT_STREAMABLE1( cls, base1 ) \
1692IMPLEMENT_STREAMABLE_CLASS( cls ); \
1693IMPLEMENT_ABSTRACT_STREAMABLE1( cls, base1 )
1695#define IMPLEMENT_STREAMABLE2( cls, base1, base2 ) \
1696IMPLEMENT_STREAMABLE_CLASS( cls ); \
1697IMPLEMENT_ABSTRACT_STREAMABLE2( cls, base1, base2 )
1699#define IMPLEMENT_STREAMABLE3( cls, base1, base2, base3 ) \
1700IMPLEMENT_STREAMABLE_CLASS( cls ); \
1701IMPLEMENT_ABSTRACT_STREAMABLE3( cls, base1, base2, base3 )
1703#define IMPLEMENT_STREAMABLE4( cls, base1, base2, base3, base4 ) \
1704IMPLEMENT_STREAMABLE_CLASS( cls ); \
1705IMPLEMENT_ABSTRACT_STREAMABLE4( cls, base1, base2, base3, base4 )
1707#define IMPLEMENT_STREAMABLE5( cls, base1, base2, base3, base4, base5 )\
1708IMPLEMENT_STREAMABLE_CLASS( cls ); \
1709IMPLEMENT_ABSTRACT_STREAMABLE5( cls, base1, base2, base3, base4, base5 )
1711#define IMPLEMENT_STREAMABLE_FROM_BASE( cls, base1 ) \
1712IMPLEMENT_STREAMABLE_CLASS( cls ); \
1713IMPLEMENT_STREAMABLE_CTOR1( cls, base1 ); \
1714IMPLEMENT_STREAMABLE_POINTER( cls )
1718#define IMPLEMENT_ABSTRACT_STREAMABLE( cls )
1719#define IMPLEMENT_ABSTRACT_STREAMABLE1( cls, base1 )
1720#define IMPLEMENT_ABSTRACT_STREAMABLE2( cls, base1, base2 )
1721#define IMPLEMENT_ABSTRACT_STREAMABLE3( cls, base1, base2, base3 )
1722#define IMPLEMENT_ABSTRACT_STREAMABLE4( cls, base1, base2, base3, base4 )
1723#define IMPLEMENT_ABSTRACT_STREAMABLE5( cls, base1, base2, base3, base4, base5 )
1724#define IMPLEMENT_STREAMABLE( cls )
1725#define IMPLEMENT_STREAMABLE1( cls, base1 )
1726#define IMPLEMENT_STREAMABLE2( cls, base1, base2 )
1727#define IMPLEMENT_STREAMABLE3( cls, base1, base2, base3 )
1728#define IMPLEMENT_STREAMABLE4( cls, base1, base2, base3, base4 )
1729#define IMPLEMENT_STREAMABLE5( cls, base1, base2, base3, base4, base5 )
1730#define IMPLEMENT_STREAMABLE_FROM_BASE( cls, base1 )
TNewStreamer(TStreamableBase *obj)
Constructs the TNewStreamer object, and initializes the streamable object pointer.
virtual LPCSTR StreamableName() const
Provides a base class for all streamable objects.
virtual void * Read(ipstream &is, uint32) const
This pure virtual member function must be redefined for every streamable class.
virtual LPCSTR StreamableName() const
This pure virtual member function must be redefined for every streamable class.
TOldStreamer(TStreamable *obj)
Constructs the TOldStreamer object, and initializes the streamable object pointer.
virtual void Write(opstream &os) const
This pure virtual function must be redefined for every streamable class.
TPWObj(const void *adr, P_id_type id)
Classes that inherit from TStreamableBase are known as streamable classes (their objects can be writt...
TStreamableClass is used by the private database class and pstream in the registration of streamable ...
virtual LPCSTR streamableName() const =0
virtual void * read(ipstream &)=0
virtual void write(opstream &)=0
Provides a base class for all streamable objects.
virtual void Write(opstream &) const =0
This pure virtual function must be redefined for every streamable class.
TStreamer(TStreamableBase *obj)
Constructs the TStreamer object, and initializes the streamable object pointer.
virtual void * Read(ipstream &, uint32) const =0
This pure virtual member function must be redefined for every streamable class.
TStreamableBase * GetObject() const
Returns the address of the TStreamableBase component of the streamable object.
Provides the basic operations common to all object file stream I/O.
void open(LPCSTR, int, int=openprot)
Opens the named file in the given mode (app, ate, in, out, binary, trunc, nocreate,...
ifpstream is a simple "mix" of its bases, fpbase and ipstream.
ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting...
ipstream & seekg(std::streamoff, std::ios::seekdir)
void readVersion()
Reads the version number of the input stream.
ipstream & seekg(std::streampos)
Provides the base class for writing (inserting) streamable objects to file streams.
Base class for writing streamable objects.
opstream(std::streambuf *)
opstream & seekp(std::streamoff, std::ios::seekdir)
void writeByte(uint8)
Writes the byte ch to the stream.
opstream & seekp(std::streampos)
void writeWord32(uint32)
Writes the 32-bit word us to the stream.
Base class for handling streamable objects.
PointerTypes
Enumerates object pointer types.
int good() const
Returns nonzero if no error states have been recorded for the stream (that is, no errors have occurre...
void registerVB(TStreamableBase *adr)
Registers a virtual base class.
int operator!() const
Overloads the NOT operator.
void registerObject(TStreamableBase *adr)
Registers the class of the object pointed to by adr.
std::filebuf * rdbuf()
Returns a pointer to the current file buffer.
void registerObject(TStreamableBase *adr)
Registers the object pointed to by adr.
std::streambuf * rdbuf() const
Returns the pb pointer to the buffer assigned to the stream.
P_id_type findObject(TStreamableBase *adr)
Returns the type ID for the object pointed to by adr.
ifpstream()
Creates a buffered ifpstream object using a default buffer.
P_id_type findVB(TStreamableBase *adr)
Returns a pointer to the virtual base.
void open(LPCSTR, int=std::ios::out, int=fpbase::openprot)
Opens the named file in the given mode (app, ate, in, out, binary, trunc, nocreate,...
int bad() const
Returns nonzero if an error occurs.
void writeSuffix(const TStreamableBase *)
Writes the class name suffix to the stream.
void clear(int=0)
Sets the stream state to the given value (defaults to 0).
ipstream()
Creates a buffered ipstream without initializing the buffer pointer, bp.
#define _OBJ_TYPENAME(obj)
void writeWord(uint32)
Writes the 32-bit word us to the stream.
pstream()
Creates a pstream without initializing the buffer pointer bp or state.
uint32 getVersion() const
Returns the object version number.
void ReadBaseObject(Base *base, ipstream &in)
void open(LPCSTR, int=std::ios::in, int=fpbase::openprot)
It opens the named file in the given mode (app, ate, in, out, binary, trunc, nocreate,...
TStreamableBase * find(P_id_type)
Returns a pointer to the object corresponding to Id.
void setstate(int)
Updates the state data member with state |= (b & 0xFF).
fpbase()
Creates a buffered fpbase object.
void ReadVirtualBase(Base *base, ipstream &in)
void WriteVirtualBase(Base *base, opstream &out)
ofpstream()
Creates a buffered ofpstream object using a default buffer.
int eof() const
Returns nonzero on end of stream.
int rdstate() const
Returns the current state value.
int fail() const
Returns nonzero if a previous stream operation failed.
std::filebuf * rdbuf()
Returns a pointer to the current file buffer.
void WriteBaseObject(Base *base, opstream &out)
void init(std::streambuf *)
The init member function initializes the stream and sets state to 0 and bp to sbp.
Object Windows Library (OWLNext Core)
owl::opstream & operator<<(owl::opstream &os, const TColor &c)
Insert the color value into a persistent output stream.
owl::ipstream & operator>>(owl::ipstream &is, TColor &c)
Extract the color value from a persistent input stream.
General definitions used by all ObjectWindows programs.
#define STATIC_CAST(targetType, object)
Class definitions for object streaming.