Menu

Object Streaming in owlnext 7

Anonymous
2026-03-31
2026-04-01
  • Anonymous

    Anonymous - 2026-03-31

    I am converting an old owl 5 program to OwlNext 7. Im trying to retain backwards file compatibility with the existing software. The classes are streamed to file and read back using DECLARE_STREAMABLE and IMPLEMENT_STREAMABLE macros then using the >> or << GetObject()->. Im having no luck getting this to work. Is this even possible? Thx

     
    • Ognyan Chernokozhev

      It should be possible. What errors are you encountering?

      Have you tried first to upgrade to OWLNext 6.44 as it is closer to legacy OWL?

      See also https://sourceforge.net/p/owlnext/wiki/Upgrading_from_OWL/

       

      Last edit: Ognyan Chernokozhev 2026-03-31
  • Anonymous

    Anonymous - 2026-03-31

    I tried to get 6.44 to work and coulndt get a simple hello world app to compile so switched to 7 and had much better luck. Now that my 7 app is running maybe I shoud try 6.44. I dont think Streamer is a part of TStreamableBase anymore. Here is parts of my OWL5 code

    class TPair : public TStreamableBase
    {
    public:
    TPair();
    int On;
    int Off;
    int Credit;
    char Length;
    char AdjLength;
    int TAFB;
    int Number;
    string FullIdent;
    int Dops[31]; // 0 doesn't operate 1 it does 2 it is assigned
    void DumpDataToClipboard(void);
    friend class TPilot;
    TPair& operator = (TPair& ThePair );
    DECLARE_STREAMABLE(,TPair,5); // version is now 5
    };

    ===== cpp file =======

    IMPLEMENT_CASTABLE(TPair);
    IMPLEMENT_STREAMABLE(TPair);

    void* TPair::Streamer::Read( ipstream& in, uint32 version )const
    {
    int j;
    in >> GetObject()->On >> GetObject()->Off >> GetObject()->Credit >> GetObject()->Length;
    in >> GetObject()->TAFB >> GetObject()->Number >> GetObject()->Valid;
    for(j=0;j<31;j++)in >> GetObject()->Dops[j];
    if( version > 2 )in >> GetObject()->RestRequiredAfter;
    if( version > 3 )in >> GetObject()->PRGData;
    if( version > 4 )for(j=0;j<31;j++) in >> GetObject()->PairingType[j];
    return GetObject();
    }

    void TPair::Streamer::Write( opstream& out )const
    {
    int j;
    out << GetObject()->On << GetObject()->Off << GetObject()->Credit << GetObject()->Length;
    out << GetObject()->TAFB << GetObject()->Number << GetObject()->Valid;
    for(j=0;j<31;j++) out << abs(GetObject()->Dops[j]);

     
    • Ognyan Chernokozhev

      Hi,

      Persisten streams are being deprecated and available only when using the OWL5_COMPAT define. You need to add that define to the project options.
      See https://sourceforge.net/p/owlnext/wiki/Replacing_the_Borland_C%2B%2B_Class_Libraries/#h-persistent-streams

      Also you can check and test the Pstream example under examples/pstream.

       
  • Vidar Hasfjord

    Vidar Hasfjord - 2026-04-01

    Hi, welcome to the forum!

    I am converting an old owl 5 program to OwlNext 7

    As Ognyan pointed to, did you follow the "Recommended step-by-step approach" in our upgrade guide? If you did, and you ran into problems, please let us know in which step problems occurred, so that the guidelines can be improved.

    Also, see sticky post about upgrading [discussion:64acd4d0].

     

    Related

    Discussion: 64acd4d0

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB