1 // Copyright (C) 2013-2015 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 #include "SimanIO_Activity.hxx"
22 SimanIO_Activity::SimanIO_Activity()
26 void SimanIO_Activity::SetName(const char* theName)
31 const char* SimanIO_Activity::Name() const
33 return myName.c_str();
36 void SimanIO_Activity::SetModule(const char* theModuleName)
38 myModule = theModuleName;
41 const char* SimanIO_Activity::Module() const
43 return myModule.c_str();
46 void SimanIO_Activity::AddDocument(const int theID, const SimanIO_Document& theDoc)
48 myDocs[theID] = theDoc;
51 SimanIO_Document& SimanIO_Activity::Document(const int theId)
56 const int SimanIO_Activity::DocumentMaxID() const
58 if (myDocs.empty()) return -1;
59 return myDocs.rbegin()->first; // documents in map are ordered by ID, so, the last one has the bigger ID
62 SimanIO_Document& SimanIO_Activity::GetOrCreateDocument(const int theId)
64 if (myDocs.find(theId) == myDocs.end()) {
65 myDocs[theId] = SimanIO_Document();
70 //////////////////////////// Iterator methods /////////////////////////
71 SimanIO_Activity::DocumentsIterator::DocumentsIterator(/*const*/ SimanIO_Activity& theActivity)
73 myIter = theActivity.myDocs.begin();
74 myEnd = theActivity.myDocs.end();
77 void SimanIO_Activity::DocumentsIterator::Next()
82 bool SimanIO_Activity::DocumentsIterator::More()
84 return myIter != myEnd;
87 /*const*/ SimanIO_Document& SimanIO_Activity::DocumentsIterator::Document()
89 return myIter->second;
92 const int SimanIO_Activity::DocumentsIterator::DocId()