1 // Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef SIMANIO_ACTIVITY_H
21 #define SIMANIO_ACTIVITY_H
23 #include "SimanIO_Document.hxx"
29 * \brief Class for storage and store CFG file activity information.
31 class SimanIO_Activity {
32 std::string myName; ///< name of the activity
33 std::string myModule; ///< module of the activity
34 typedef std::map<int, SimanIO_Document> ActivityDocuments;
35 ActivityDocuments myDocs; ///< documents of the activity, referenced by document ID
38 * Creates the empty, default activity.
43 * Defines the activity name.
44 * \param theName name of the activity (enclosed by "" in CFG file).
46 void SetName(const char* theName);
49 * Returns the name of the activity.
51 const char* Name() const;
54 * Defines the activity module.
55 * \param theModuleName name of the module in SALOME
57 void SetModule(const char* theModuleName);
60 * Returns the module of the activity.
62 const char* Module() const;
65 * Appends the documents to this activity.
66 * \param theID identifier of the document, unique for whole configuration file.
67 * \param theDoc document with all fields filled
69 void AddDocument(const int theID, const SimanIO_Document& theDoc);
72 * Returns the document by its Id, crashes if there is no such document.
73 * \returns reference to the document.
75 SimanIO_Document& Document(const int theId);
78 * Returns id of one of the documents of this activity: maximal ID.
79 * \returns -1 if activity has no documents
81 const int DocumentMaxID() const;
84 * Creates or returns existing document with the given Id.
85 * \param theId identifier of the document
86 * \return reference to document, already stored in the activity
88 SimanIO_Document& GetOrCreateDocument(const int theId);
90 //! Iterator for activity documents browsing
91 class DocumentsIterator {
92 ActivityDocuments::iterator myIter; ///< iterator by the documents of the activity
93 ActivityDocuments::const_iterator myEnd; ///< end iteration indicator
95 ///! Launches the iterator
96 DocumentsIterator(/*const*/ SimanIO_Activity& theActivity);
97 ///! Iterates to the next document of the Activity.
99 ///! Returns tru if the current document exists.
101 ///! Returns the current document Id.
103 ///! Returns the current document.
104 /*const*/ SimanIO_Document& Document();