CFx SDK Documentation  2023 SP0
daiRepository.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2019, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Open Design Alliance software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Open Design Alliance Copyright (C) 2002-2019 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 #ifndef _DAI_REPOSITORY_H
25 #define _DAI_REPOSITORY_H
26 
27 #include "SharedPtr.h"
28 #include "daiDictionaryInstance.h"
29 #include "daiSessionInstance.h"
30 
31 #include "sdai.h"
32 #include "OdStreamBuf.h"
33 #include "OdArray.h"
34 
35 #include "SmartPtr.h"
36 
37 #define REPOSITORY_DEFAULE_MODEL_NAME "default"
38 
40 
41 namespace OdDAI {
42 
43 
44  class OdHeaderSection;
46 
47  class Model;
49 
50  class Schema;
52 
54  {
55  public:
56 
57  //DOM-IGNORE-BEGIN
59  //DOM-IGNORE-END
60 
62 
68  {
69  m_svcs = svcs;
70  }
71 
76  OdString name() const
77  {
78  return m_name;
79  }
80 
84  void name(const OdString &name)
85  {
86  m_name = name;
87  }
88 
89  const OdArray<ModelPtr>& models() const { return m_models; };
90 
97  ModelPtr createModel(const OdAnsiString &name, const OdAnsiString &schemaName);
98 
105  ModelPtr createModel(const OdAnsiString &name, const SchemaPtr schema);
106 
107 
113  const ModelPtr getModel(ModelPtr& modelPtr) const;
114 
121 
122 
128  const ModelPtr getModel(const OdAnsiString &modelName = REPOSITORY_DEFAULE_MODEL_NAME) const;
129 
135  ModelPtr getModelRW(const OdAnsiString &modelName = REPOSITORY_DEFAULE_MODEL_NAME);
136 
137  /* \details
138  Removes a model from repository.
139  */
140  void deleteModel(ModelPtr& model);
141 
147  SdaiAccessMode getModelAccessMode(const OdAnsiString &modelName = REPOSITORY_DEFAULE_MODEL_NAME) const;
148 
149  /* \details
150  */
152 
153  OdArray<SchemaPtr> schemas() { return m_schemas; };
154 
160 
163  OdResult readFile(const OdString& fileName);
164 
171 
180 
189 
196  virtual OdResult writeFile(const OdString& filename, bool saveLogFile = false);
197 
198  protected:
199  bool setModelAccessMode(ModelPtr& modelToSet, SdaiAccessMode accessMode) const;
200 
201  protected:
202 
205 
208 
210 
211  friend class Session;
212  };
214 }
215 
216 
217 #endif // _DAI_REPOSITORY_H
OdResult
Definition: OdResult.h:29
static OdHeaderSectionPtr readHeaderSection(OdStreamBufPtr pStream)
ModelPtr createModel(const OdAnsiString &name, const SchemaPtr schema)
const ModelPtr getModel(ModelPtr &modelPtr) const
static OdHeaderSectionPtr readHeaderSection(const OdString &fileName)
ModelPtr getModelRW(ModelPtr &modelPtr)
bool setModelAccessMode(ModelPtr &modelToSet, SdaiAccessMode accessMode) const
OdString name() const
Definition: daiRepository.h:76
OdResult initialize()
void setAppServices(OdDAIHostAppServicesBase *svcs)
Definition: daiRepository.h:67
ODRX_DECLARE_MEMBERS(Repository)
ModelPtr createModel(const OdAnsiString &name, const OdAnsiString &schemaName)
OdDAIHostAppServicesBase * m_svcs
void deleteModel(ModelPtr &model)
OdArray< SchemaPtr > m_schemas
const OdArray< ModelPtr > & models() const
Definition: daiRepository.h:89
OdResult readFile(const OdString &fileName)
SdaiAccessMode getModelAccessMode(const OdAnsiString &modelName=REPOSITORY_DEFAULE_MODEL_NAME) const
OdHeaderSectionPtr getHeaderSection()
virtual OdResult writeFile(const OdString &filename, bool saveLogFile=false)
ModelPtr getModelRW(const OdAnsiString &modelName=REPOSITORY_DEFAULE_MODEL_NAME)
const ModelPtr getModel(const OdAnsiString &modelName=REPOSITORY_DEFAULE_MODEL_NAME) const
OdArray< ModelPtr > m_models
void name(const OdString &name)
Definition: daiRepository.h:84
OdResult readStream(OdStreamBufPtr pStream)
OdHeaderSectionPtr m_pHeaderSection
OdArray< SchemaPtr > schemas()
#define DAI_EXPORT
#define REPOSITORY_DEFAULE_MODEL_NAME
Definition: daiRepository.h:37
GLuint const GLchar * name
Definition: gles2_ext.h:265
OdSmartPtr< Repository > RepositoryPtr
OdSmartPtr< Schema > SchemaPtr
Definition: daiRepository.h:50
OdSmartPtr< OdHeaderSection > OdHeaderSectionPtr
OdSmartPtr< Model > ModelPtr
Definition: daiModel.h:56
SdaiAccessMode
Definition: sdai.h:298