1 #ifndef SIMANIO_ACTIVITY_H
2 #define SIMANIO_ACTIVITY_H
4 #include <SimanIO_Document.hxx>
9 * \brief Class for storage and store CFG file activity information.
11 class SimanIO_Activity {
12 std::string myName; ///< name of the activity
13 std::string myModule; ///< module of the activity
14 typedef std::map<int, SimanIO_Document> ActivityDocuments;
15 ActivityDocuments myDocs; ///< documents of the activity, referenced by document ID
18 * Creates the empty, default activity.
23 * Defines the activity name.
24 * \param theName name of the activity (enclosed by "" in CFG file).
26 void SetName(const char* theName);
29 * Returns the name of the activity.
31 const char* Name() const;
34 * Defines the activity module.
35 * \param theModuleName name of the module in SALOME
37 void SetModule(const char* theModuleName);
40 * Returns the module of the activity.
42 const char* Module() const;
45 * Appends the documents to this activity.
46 * \param theID identifier of the document, unique for whole configuration file.
47 * \param theDoc document with all fields filled
49 void AddDocument(const int theID, const SimanIO_Document& theDoc);
52 * Returns the document by its Id, crashes if there is no such document.
53 * \returns reference to the document.
55 SimanIO_Document& Document(const int theId);
58 * Returns id of one of the documents of this activity: maximal ID.
59 * \returns -1 if activity has no documents
61 const int DocumentMaxID() const;
64 * Creates or returns existing document with the given Id.
65 * \param theId identifier of the document
66 * \return reference to document, already stored in the activity
68 SimanIO_Document& GetOrCreateDocument(const int theId);
70 //! Iterator for activity documents browsing
71 class DocumentsIterator {
72 ActivityDocuments::iterator myIter; ///< iterator by the documents of the activity
73 ActivityDocuments::const_iterator myEnd; ///< end iteration indicator
75 ///! Launches the iterator
76 DocumentsIterator(/*const*/ SimanIO_Activity& theActivity);
77 ///! Iterates to the next document of the Activity.
79 ///! Returns tru if the current document exists.
81 ///! Returns the current document Id.
83 ///! Returns the current document.
84 /*const*/ SimanIO_Document& Document();