~vbursian/research-assistant/intervers

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
////////////////////////////////////////////////////////////////////////////////
/*! @file Net.h   Абстракция сети RANet.
- Part of RANet - Research Assistant Net Library.
- Copyright(C) 2006-2020, Viktor E. Bursian, St.Petersburg, Russia.
                          VBursian AT gmail DOT com
*///////////////////////////////////////////////////////////////////////////////
#ifndef Net_H
#define Net_H
#include "NodePtr.h"
#include "Time.h"
#include <list>
namespace RA {
//------------------------------------------------------------------------------

//ANNOUNCE_ABSTRACT_CLASS(sNet)  //already predeclared in NodeLocation.h

//----------------------------------------------------------------------sNet ---
/*! RANet Knowledgebase class, being a container for all nodes and attributes;
    also, manages their storaging and loading, possibly, in a number of
    partitions, having different formats.
*/
class RANet_EXPORT  sNet
{
  public:
    static const int          BackgroundLockingTimeout;

  public:
    virtual                   ~sNet () {}
    virtual void              Save (psNode);
    virtual void              SaveAttributes (psNode);
    virtual void              Refresh (psNode);
    virtual void              RefreshAttributes (psNode);

  public://implementation dependent
    virtual sNodePtr &        Root () =0;
    virtual void              RegisterNode (pcsNodeLocation  location
                                           ,psNode           node    ) =0;
    virtual sNodePtr          GetNode (pcsNodeLocation) =0;
    virtual void              GetAttrList (std::list<sAttribute> &
                                          ,pcsNodeLocation) =0;

  public://front-end
    virtual bool              CreateNew () =0;
    virtual bool              PreOpenSetUp () =0;
    virtual bool              Open (sString textual_URL) =0;
    virtual bool              Open () =0;
    virtual void              Close () =0;
    virtual bool              IsOpen () =0;
    virtual sString           DesktopInfoText () =0;

  protected://back-end
    virtual psNode            LoadNode (pcsNodeLocation) =0;
    virtual bool              StoreNewNode (psNode ,rsTime when) =0;
    virtual bool              UpdateNode (psNode ,rsTime when) =0;
    virtual bool              StoreNewAttribute (pcsNodeLocation   host
                                                ,rcsAttrName  name
                                                ,pcsNodeLocation   value
                                                ,rsTime            when ) =0;
    virtual bool              RemoveAttribute (pcsNodeLocation   host
                                              ,rcsAttrName  name) =0;
    virtual bool              RemoveAttribute (pcsNodeLocation   host
                                              ,pcsNodeLocation   value) =0;
    virtual bool              GetNodeStorageTime (pcsNodeLocation,rsTime) =0;

  protected:
                              sNet ();
    virtual pcsNodeLocation   GetLocation (pcsNode);
                                //!< Get location of the node
                                //! (backdoor to private sNode::Location).
    virtual void              SetLocation (psNode,pcsNodeLocation);
                                //!< Set location for the node
                                //! (backdoor to private sNode::Location).

  private:
                              sNet (rcsNet)
                                {}
    rsNet                     operator = (rcsNet)
                                { return *this; }

//    virtual bool              Allocate (psNode,...) =0;
//                                //!< Calculate and set a location for the node,
//                                //! which is an attribute of the host.
//    virtual bool              Allocate (psNode) =0;
//                                //!< Set a default location for the node.

//    psNodeLocation            GetAttrLocation (pcsNodeLocation  host
//                                              ,rcsAttrName attr_name) =0;

//    virtual void              ReleaseNode (tNodeUID) =0;
//    virtual void              Allocate (rcsAttribute A ,psNode Host) =0;
//    virtual void              AllocateMandatory (psNode               Node
//                                                ,sNodeLocation::eType LType
//                                                ,rcsString            LPath) =0;
//    virtual void              Allocate (psNode) =0;
//    virtual void              PreallocateNode (psNode          Node
//                                              ,sNodePtr        Host
//                                              ,sAttrName  AN   ) =0;
//    virtual bool              SaveNode (psNode) =0;
//    virtual bool              GetReadingAccess (sNodePtr) =0;
//    virtual void              ReleaseReadingAccess (sNodePtr) =0;
//    virtual bool              GetFullAccess (sNodePtr) =0;
//    virtual void              ReleaseFullAccess (sNodePtr) =0;
//    virtual bool              TooLongWaiting () =0;

  public: //fields
//    sString                   Owner;
//    int                       Copy;
//    sNodePtr                  Root;
//    sUndoRedo                 Undo;

  protected: //fields
};

//------------------------------------------------------------------------------
} //namespace RA
#endif