1 // Copyright (C) 2013-2014 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, or (at your option) any later version.
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.hxx"
25 #include "SimanIO_Document.hxx"
31 * \brief Class for storage and store CFG file activity information.
33 class SIMANIO_EXPORT SimanIO_Activity {
34 std::string myName; ///< name of the activity
35 std::string myModule; ///< module of the activity
36 typedef std::map<int, SimanIO_Document> ActivityDocuments;
37 ActivityDocuments myDocs; ///< documents of the activity, referenced by document ID
40 * Creates the empty, default activity.
45 * Defines the activity name.
46 * \param theName name of the activity (enclosed by "" in CFG file).
48 void SetName(const char* theName);
51 * Returns the name of the activity.
53 const char* Name() const;
56 * Defines the activity module.
57 * \param theModuleName name of the module in SALOME
59 void SetModule(const char* theModuleName);
62 * Returns the module of the activity.
64 const char* Module() const;
67 * Appends the documents to this activity.
68 * \param theID identifier of the document, unique for whole configuration file.
69 * \param theDoc document with all fields filled
71 void AddDocument(const int theID, const SimanIO_Document& theDoc);
74 * Returns the document by its Id, crashes if there is no such document.
75 * \returns reference to the document.
77 SimanIO_Document& Document(const int theId);
80 * Returns id of one of the documents of this activity: maximal ID.
81 * \returns -1 if activity has no documents
83 const int DocumentMaxID() const;
86 * Creates or returns existing document with the given Id.
87 * \param theId identifier of the document
88 * \return reference to document, already stored in the activity
90 SimanIO_Document& GetOrCreateDocument(const int theId);
92 //! Iterator for activity documents browsing
93 class SIMANIO_EXPORT DocumentsIterator {
94 ActivityDocuments::iterator myIter; ///< iterator by the documents of the activity
95 ActivityDocuments::const_iterator myEnd; ///< end iteration indicator
97 ///! Launches the iterator
98 DocumentsIterator(/*const*/ SimanIO_Activity& theActivity);
99 ///! Iterates to the next document of the Activity.
101 ///! Returns tru if the current document exists.
103 ///! Returns the current document Id.
105 ///! Returns the current document.
106 /*const*/ SimanIO_Document& Document();