Version: 9.16.0
Catalog.cxx
Go to the documentation of this file.
1// Copyright (C) 2006-2026 CEA, EDF
2//
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.
7//
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.
12//
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
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#include "Catalog.hxx"
22#include "TypeCode.hxx"
23#include "Node.hxx"
24#include "ComposedNode.hxx"
25
26//#define _DEVDEBUG_
27#include "YacsTrace.hxx"
28
29using namespace std;
30using namespace YACS::ENGINE;
31
32Catalog::Catalog(const std::string& name):_name(name)
33{
34}
35
37{
38 DEBTRACE("Catalog::~Catalog");
39 //decref type codes in map
40 std::map<std::string, TypeCode *>::iterator pt;
41 for(pt=_typeMap.begin();pt!=_typeMap.end();pt++)
42 ((*pt).second)->decrRef();
43
44 //get rid of component definitions in map
45 std::map<std::string, ComponentDefinition*>::const_iterator lt;
46 for(lt=_componentMap.begin();lt!=_componentMap.end();lt++)
47 delete (*lt).second;
48
49 //get rid of nodes in map
50 std::map<std::string, Node*>::const_iterator nt;
51 for(nt=_nodeMap.begin();nt!=_nodeMap.end();nt++)
52 delete (*nt).second;
53
54 //get rid of composed nodes in map
55 std::map<std::string, ComposedNode*>::const_iterator ct;
56 for(ct=_composednodeMap.begin();ct!=_composednodeMap.end();ct++)
57 delete (*ct).second;
58
59}
60
62{
63}
64
65CatalogLoader::CatalogLoader(const std::string& path):_path(path)
66{
67}
68
70{
71 DEBTRACE("CatalogLoader::~CatalogLoader");
72}
73
74void CatalogLoader::load(Catalog* cata,const std::string& path)
75{
76 CatalogLoader* CL=newLoader(path);
77 CL->loadCata(cata);
78 delete CL;
79}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
class for YACS catalog loader.
Definition: Catalog.hxx:63
virtual void loadCata(Catalog *cata)=0
virtual void load(Catalog *cata, const std::string &path)
Definition: Catalog.cxx:74
virtual CatalogLoader * newLoader(const std::string &path)=0
class for YACS catalogs.
Definition: Catalog.hxx:42
std::map< std::string, ComposedNode * > _composednodeMap
Definition: Catalog.hxx:52
std::map< std::string, ComponentDefinition * > _componentMap
Definition: Catalog.hxx:50
std::map< std::string, Node * > _nodeMap
Definition: Catalog.hxx:51
std::map< std::string, TypeCode * > _typeMap
Definition: Catalog.hxx:49
virtual ~Catalog()
Definition: Catalog.cxx:36