Back to index

salome-kernel  6.5.0
DF_Application.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef DFAPPLICATION_HXX
00021 #define DFAPPLICATION_HXX
00022 
00023 #include "DF_definitions.hxx"
00024 #include "DF_Document.hxx"
00025 #include <string>
00026 #include <map>
00027 
00028 //Class DF_Application responsible for creation and manipulation of Documents
00029 class DF_Application {
00030 public:
00031   //Constructor
00032   Standard_EXPORT DF_Application();
00033 
00034   Standard_EXPORT ~DF_Application();
00035   
00036   //Creates a new document with given type, returns a smart pointer to
00037   //newly created document.
00038   Standard_EXPORT DF_Document* NewDocument(const std::string& theDocumentType);
00039 
00040   //Closes and removes the given Document
00041   Standard_EXPORT void Close(const DF_Document* theDocument);
00042 
00043   //Returns a Document by Document's ID
00044   Standard_EXPORT DF_Document* GetDocument(int theDocumentID);
00045 
00046   //Returns a list of IDs of all currently opened documents
00047   Standard_EXPORT std::vector<int> GetDocumentIDs();
00048 
00049   //Returns a number of existent documents
00050   Standard_EXPORT int NbDocuments();
00051 
00052   //Virtual methods to be redefined if required by specific application
00053 
00054   //Restores a Document from the given file, returns a smart 
00055   //pointer to opened document.
00056   Standard_EXPORT virtual DF_Document* Open(const std::string& theFileName);
00057 
00058   //Saves a Document in a given file with name theFileName
00059   Standard_EXPORT virtual void SaveAs(const DF_Document* theDocument, const std::string& theFileName);
00060 
00061 private:
00062   int                           _currentID;
00063   std::map<int, DF_Document*> _documents;
00064 
00065 };
00066 #endif