Generic Storage Manager. More...

#include <gstorage.h>

Inheritance diagram for GStorage:
[legend]

Public Member Functions

 GStorage (GSession *session, GPlugInFactory *fac)
 
virtual ~GStorage (void)
 
Suggestions Methods
virtual void SaveSugs (const GSugs &sugs, size_t max=R::cNoRef)=0
 
virtual void LoadSugs (GSugs &sugs)=0
 
- Public Member Functions inherited from GPlugIn
 GPlugIn (GSession *session, GPlugInFactory *fac)
 
virtual void ApplyConfig (void)
 
void InsertParam (R::RParam *param)
 
template<class T >
T * FindParam (const R::RString &name)
 
R::RCursor< R::RParamGetParams (const R::RString &cat=R::RString::Null)
 
void GetCategories (R::RContainer< R::RString, true, false > &cats)
 
virtual void Init (void)
 
virtual void CreateConfig (void)
 
virtual void Reset (void)
 
GPlugInFactoryGetFactory (void) const
 
int Compare (const GPlugIn &plugin) const
 
int Compare (const R::RString &plugin) const
 
R::RString GetName (void) const
 
R::RString GetDesc (void) const
 
GSessionGetSession (void) const
 
virtual void Done (void)
 
virtual ~GPlugIn (void)
 

Protected Attributes

bool LoadAll
 
R::RDate Filter
 
bool Filtering
 
bool AllMemory
 
- Protected Attributes inherited from GPlugIn
GPlugInFactoryFactory
 
GSessionSession
 
size_t Id
 

Private Member Functions

Documents Methods
virtual void AssignId (GDoc *doc)=0
 
virtual void LoadObj (GDoc *&doc, size_t docid)=0
 
virtual void LoadObj (GDoc *&doc, const R::RString &url)=0
 
virtual void LoadObjs (const GDoc *obj)=0
 
virtual void SaveObj (GDoc *doc)=0
 
Users/Profiles Methods
virtual void LoadObjs (const GUser *obj)=0
 
virtual void LoadObj (GUser *&user, size_t userid)=0
 
virtual void LoadObj (GUser *&user, const R::RString &name)=0
 
virtual void LoadObj (GProfile *&profile, size_t profileid)=0
 
virtual void LoadObj (GProfile *&profile, const R::RString &name)=0
 
virtual void UpdateProfiles (size_t docid)=0
 
virtual void AssignId (GUser *user)=0
 
virtual void AssignId (GProfile *p)=0
 
virtual void SaveObj (GUser *user)=0
 
virtual void SaveObj (GProfile *prof)=0
 
virtual void UpdateFdbk (GProfile *prof, GDoc *doc, tFdbkType fdbk, R::RDate done)=0
 
Topics Methods
virtual void LoadObjs (const GTopic *topic)=0
 
virtual void LoadObj (GTopic *&topic, size_t topicid)=0
 
virtual void UpdateTopics (size_t docid)=0
 
virtual void AssignId (GTopic *top)=0
 
virtual void SaveObj (GTopic *grp)=0
 

General Methods

virtual void ApplyParams (void)
 
virtual size_t GetNbSaved (tObjType type)=0
 
virtual void * GetInfos (void)
 
bool IsAllInMemory (void) const
 
bool UseFiltering (void) const
 
R::RDate GetFilter (void) const
 
virtual void ExecuteData (const R::RString &filename)=0
 
virtual void LoadObjs (const GSubject *)=0
 
virtual void SaveObj (GSubject *subject)=0
 
virtual void Clear (tObjType objtype)=0
 

Knowledge Methods

virtual R::RString LoadObj (const GConcept *obj, size_t id)=0
 
virtual size_t LoadObj (const GConcept *obj, const R::RString name, GConceptType *type)=0
 
virtual void LoadObjs (const GConceptType *obj)=0
 
virtual void AssignId (GConceptType *type)=0
 
virtual void LoadObjs (const GConcept *obj)=0
 
virtual void AssignId (GConcept *concept)=0
 
virtual void DeleteObj (GConcept *concept)=0
 
virtual void SaveObj (GConcept *concept)=0
 
virtual void SaveIndex (const GConcept *concept, tObjType what, size_t index)=0
 
virtual void ClearIndex (tObjType what)=0
 
virtual void SaveRefs (GConceptType *type, tObjType what, size_t refs)=0
 
virtual void ClearRefs (tObjType what)=0
 
virtual void LoadObjs (const GStatement *obj)=0
 
virtual void AssignId (GStatement *statement)=0
 
virtual void LoadObj (GClass *&classp, size_t classid)=0
 
virtual void LoadObj (GClass *&classp, const R::RString &name)=0
 
virtual void LoadObjs (const GClass *obj)=0
 
virtual void AssignId (GClass *theclass)=0
 
virtual void SaveObj (GClass *theclass)=0
 

Communities Methods

virtual void SaveDocs (const GCommunityDocs &docs)=0
 
virtual void LoadDocs (GCommunityDocs &docs)=0
 
virtual void LoadObjs (const GCommunity *obj)=0
 
virtual void LoadObj (GCommunity *&community, size_t groupid)=0
 
virtual void UpdateCommunities (size_t profid)=0
 
virtual void AssignId (GCommunity *grp)=0
 
virtual void SaveObj (GCommunity *grp)=0
 

Detailed Description

Generic Storage Manager.

The GStorage provides a representation for a storage manager. This storage manager is responsible to load and save data.

Most methods are private because they are automatically called by the managing classes (GSession, GObjects, etc.).

See the documentation related to GPlugIn for more general information.

Constructor & Destructor Documentation

GStorage ( GSession session,
GPlugInFactory fac 
)

Constructor.

Parameters
sessionSession.
facFactory of the plug-in.
virtual ~GStorage ( void  )
virtual

Destruct.

Member Function Documentation

virtual void ApplyParams ( void  )
virtual

Configurations were applied from the factory.

virtual size_t GetNbSaved ( tObjType  type)
pure virtual

Compute the number of objects of a given type which are saved.

Parameters
typeType of the objects.
Returns
Number of objects.
virtual void* GetInfos ( void  )
virtual

Get a pointer to a structure that should represent the storage. It can be used to give access to some internal methods specific to a given storage. It should be used carefully.

bool IsAllInMemory ( void  ) const

Are all the object loaded or just some of them (modified or because filters).

bool UseFiltering ( void  ) const

Using a date for filtering.

R::RDate GetFilter ( void  ) const

Get the filtering date.

virtual void ExecuteData ( const R::RString filename)
pure virtual

Execute a sequence of steps needed to construct data. Typically, this can be a SQL file.

Parameters
filenameName of the file.
virtual void LoadObjs ( const GSubject )
privatepure virtual

Load the Subjects.

virtual void SaveObj ( GSubject subject)
privatepure virtual

Save the subject, including the information on the documents (and which ones are used) and the profiles assigned to them.

Parameters
subjectSubject to save.
virtual void Clear ( tObjType  objtype)
privatepure virtual

Clear the information of a given object type from the storage.

Parameters
objtypeType of the object.
virtual void LoadObjs ( const GConceptType obj)
privatepure virtual

Load the concept types from the database.

Parameters
objPseudo-parameter.
virtual void AssignId ( GConceptType type)
privatepure virtual

Assign an identifier to a new concept type.

Parameters
typeConcept type.
virtual void LoadObjs ( const GConcept obj)
privatepure virtual

Loading all concepts.

Parameters
objPseudo-parameter.
virtual void AssignId ( GConcept concept)
privatepure virtual

Assign an identifier to a new concept of a given type.

Parameters
conceptConcept.
virtual void DeleteObj ( GConcept concept)
privatepure virtual

Delete a concept.

Parameters
conceptConcept.
virtual R::RString LoadObj ( const GConcept obj,
size_t  id 
)
pure virtual

Load the name of specific concept.

Parameters
objPseudo-parameter.
idIdentifier of the concept.
virtual size_t LoadObj ( const GConcept obj,
const R::RString  name,
GConceptType type 
)
pure virtual

Load the identifier of a specific concept.

Parameters
objPseudo-parameter.
nameName of the concept.
typeType of the concept.
virtual void SaveObj ( GConcept concept)
privatepure virtual

Save a concept in the database.

Parameters
conceptConcept.
virtual void SaveIndex ( const GConcept concept,
tObjType  what,
size_t  index 
)
privatepure virtual

Save the index information of a given object type for a given concept.

Parameters
conceptConcept.
whatType of the object.
indexIdentifier of the block containing the index.
virtual void ClearIndex ( tObjType  what)
privatepure virtual

Clear all the index information of a given object type.

Parameters
whatType of the object.
virtual void SaveRefs ( GConceptType type,
tObjType  what,
size_t  refs 
)
privatepure virtual

Save the references of a given object type for a given concept type.

Parameters
typeType of the concept.
whatType of the object.
refsNumber of references.
virtual void ClearRefs ( tObjType  what)
privatepure virtual

Clear the references of a given object type.

Parameters
whatType of the object.
virtual void LoadObjs ( const GStatement obj)
privatepure virtual

Load the statements from the database.

Parameters
objPseudo-parameter.
virtual void AssignId ( GStatement statement)
privatepure virtual

Assign an identifier to a new statement.

Parameters
statementStatement.
virtual void LoadObj ( GClass *&  classp,
size_t  classid 
)
privatepure virtual

Method that load a class that is stored.

Parameters
classpPointer to the class that will be created.
classidIdentifier of the class.
virtual void LoadObj ( GClass *&  classp,
const R::RString name 
)
privatepure virtual

Method that load a class that is stored.

Parameters
classpPointer to the class that will be created.
nameName of the class.
virtual void LoadObjs ( const GClass obj)
privatepure virtual

Method that load the classes from where they are stored. This method is called once by the session.

Parameters
objPseudo-parameter.
virtual void AssignId ( GClass theclass)
privatepure virtual

Assign an identifier to a new class.

Parameters
theclassClass.
virtual void SaveObj ( GClass theclass)
privatepure virtual

Save a class.

Parameters
theclassClass.
virtual void AssignId ( GDoc doc)
privatepure virtual

Assign an identifier to a new document.

Parameters
docDocument.
virtual void LoadObj ( GDoc *&  doc,
size_t  docid 
)
privatepure virtual

Method that load a document that is stored.

Parameters
docPointer to the document that will be created.
docidIdentifier of the document.
virtual void LoadObj ( GDoc *&  doc,
const R::RString url 
)
privatepure virtual

Method that load a document that is stored.

Parameters
docPointer to the document to create.
urlURL of the document
virtual void LoadObjs ( const GDoc obj)
privatepure virtual

Method that load the documents from where they are stored. This method is called once by the session.

Parameters
objPseudo-parameter.
virtual void SaveObj ( GDoc doc)
privatepure virtual

Save a document where it is stored. This method is called after an analysis of a document if the result has to be saved. This method must be overloaded.

Parameters
docDocument to save.
virtual void LoadObjs ( const GUser obj)
privatepure virtual

Load the profiles and the users. This method is called once by the session.

Parameters
objPseudo-parameter.
virtual void LoadObj ( GUser *&  user,
size_t  userid 
)
privatepure virtual

Method that load a user that is stored.

Parameters
userPointer to the user that will be created.
useridIdentifier of the user.
virtual void LoadObj ( GUser *&  user,
const R::RString name 
)
privatepure virtual

Method that load a user that is stored.

Parameters
userPointer to the user that will be created.
nameName of the user.
virtual void LoadObj ( GProfile *&  profile,
size_t  profileid 
)
privatepure virtual

Method that load a profile that is stored.

Parameters
profilePointer to the profile that will be created.
profileidIdentifier of the profile.
virtual void LoadObj ( GProfile *&  profile,
const R::RString name 
)
privatepure virtual

Method that load a profile that is stored.

Parameters
profilePointer to the profile that will be created.
nameName of the profile.
virtual void UpdateProfiles ( size_t  docid)
privatepure virtual

A document was updated and the profiles that have made a feedback on it must be updated.

Parameters
docidIdentifier of the document.
virtual void AssignId ( GUser user)
privatepure virtual

Assign an identifier to a new user.

Parameters
userPointer to the user.
virtual void AssignId ( GProfile p)
privatepure virtual

Assign an identifier to a new profile.

Parameters
pPointer to the profile.
virtual void SaveObj ( GUser user)
privatepure virtual

Save a user.

Parameters
userUser to save.
virtual void SaveObj ( GProfile prof)
privatepure virtual

Save a profile.

Parameters
profProfile to save.
virtual void UpdateFdbk ( GProfile prof,
GDoc doc,
tFdbkType  fdbk,
R::RDate  done 
)
privatepure virtual

Update a feedback for a given profile and document. If it is a new one, it must be created in the storage.

Parameters
profProfile.
docDocument.
fdbkFeedback type.
doneDate on the last feedback.
virtual void LoadObjs ( const GCommunity obj)
privatepure virtual

Load the groups. This method is called once by the session.

Parameters
objPseudo-parameter.
virtual void LoadObj ( GCommunity *&  community,
size_t  groupid 
)
privatepure virtual

Method that load a group that is stored.

Parameters
communityPointer to the community that will be created.
groupidIdentifier of the group.
virtual void UpdateCommunities ( size_t  profid)
privatepure virtual

A profile was updated and the corresponding communities must be updated.

Parameters
profidIdentifier of the profile.
virtual void AssignId ( GCommunity grp)
privatepure virtual

Assign an identifier to a new community.

Parameters
grpCommunity.
virtual void SaveObj ( GCommunity grp)
privatepure virtual

Save a community.

Parameters
grpCommunity.
virtual void SaveDocs ( const GCommunityDocs docs)
pure virtual

Save the relevant documents associated with a given community.

Parameters
docsList of relevant.
virtual void LoadDocs ( GCommunityDocs docs)
pure virtual

Load the relevant documents associated with a given community.

Parameters
docsList of relevant.
virtual void LoadObjs ( const GTopic topic)
privatepure virtual

Load the topics. This method is called once by the session.

Parameters
topicTopic to load.
virtual void LoadObj ( GTopic *&  topic,
size_t  topicid 
)
privatepure virtual

Method that load a topic that is stored.

Parameters
topicPointer to the topic that will be created.
topicidIdentifier of the topic.
virtual void UpdateTopics ( size_t  docid)
privatepure virtual

A document was updated and the corresponding topics must be updated.

Parameters
docidIdentifier of the document.
virtual void AssignId ( GTopic top)
privatepure virtual

Assign an identifier to a new topic.

Parameters
topTopic.
virtual void SaveObj ( GTopic grp)
privatepure virtual

Save a topic.

Parameters
grpTopic.
virtual void SaveSugs ( const GSugs sugs,
size_t  max = R::cNoRef 
)
pure virtual

Save a list of suggestions.

Parameters
sugsSuggestions.
maxMaximum number of suggestions to save.
virtual void LoadSugs ( GSugs sugs)
pure virtual

Load a list of suggestions.

Parameters
sugsSuggestions.

Member Data Documentation

bool LoadAll
protected

All the objects must be loaded (true) or only those which are modified (false).

R::RDate Filter
protected

Date used to filter when load from the storage.

bool Filtering
protected

Is there a filter (Filter date is not the current one).

bool AllMemory
protected

All objects are in memory.