CFx SDK Documentation  2020SP3
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
OdResult
Definition: OdResult.h:29
OdDAI::Repository::ODRX_DECLARE_MEMBERS
ODRX_DECLARE_MEMBERS(Repository)
OdString
Definition: OdString.h:95
OdDAI::Repository
Definition: daiRepository.h:54
OdDAI::Repository::getModelRW
ModelPtr getModelRW(ModelPtr &modelPtr)
name
GLuint const GLchar * name
Definition: gles2_ext.h:265
OdDAI::Repository::getModelRW
ModelPtr getModelRW(const OdAnsiString &modelName=REPOSITORY_DEFAULE_MODEL_NAME)
OdDAI::Repository::models
const OdArray< ModelPtr > & models() const
Definition: daiRepository.h:89
OdDAI::Repository::name
void name(const OdString &name)
Definition: daiRepository.h:84
OdDAI::Repository::m_schemas
OdArray< SchemaPtr > m_schemas
Definition: daiRepository.h:207
OdArray
Definition: OdArray.h:591
OdDAI::Repository::createModel
ModelPtr createModel(const OdAnsiString &name, const SchemaPtr schema)
OdDAI::Repository::m_svcs
OdDAIHostAppServicesBase * m_svcs
Definition: daiRepository.h:209
OdDAI::Repository::m_pHeaderSection
OdHeaderSectionPtr m_pHeaderSection
Definition: daiRepository.h:204
OdDAI::Repository::m_models
OdArray< ModelPtr > m_models
Definition: daiRepository.h:206
OdDAI
Definition: daiAccessDefines.h:31
SdaiAccessMode
SdaiAccessMode
Definition: sdai.h:298
OdDAI::Repository::Repository
Repository()
OdDAI::Session
Definition: daiSession.h:55
OdStreamBuf.h
OdArray.h
OdDAI::Repository::createModel
ModelPtr createModel(const OdAnsiString &name, const OdAnsiString &schemaName)
OdSmartPtr< OdHeaderSection >
OdDAI::Repository::deleteModel
void deleteModel(ModelPtr &model)
OdDAI::Repository::setAppServices
void setAppServices(OdDAIHostAppServicesBase *svcs)
Definition: daiRepository.h:67
OdDAI::Repository::name
OdString name() const
Definition: daiRepository.h:76
daiDictionaryInstance.h
OdDAI::Repository::getModel
const ModelPtr getModel(const OdAnsiString &modelName=REPOSITORY_DEFAULE_MODEL_NAME) const
OdDAI::Repository::setModelAccessMode
bool setModelAccessMode(ModelPtr &modelToSet, SdaiAccessMode accessMode) const
OdDAIHostAppServicesBase
Definition: daiHostAppServicesBase.h:52
SharedPtr.h
OdDAI::ModelPtr
OdSmartPtr< Model > ModelPtr
Definition: daiModel.h:56
OdDAI::Repository::schemas
OdArray< SchemaPtr > schemas()
Definition: daiRepository.h:153
REPOSITORY_DEFAULE_MODEL_NAME
#define REPOSITORY_DEFAULE_MODEL_NAME
Definition: daiRepository.h:37
OdDAI::Repository::readStream
OdResult readStream(OdStreamBufPtr pStream)
OdDAI::Repository::getModelAccessMode
SdaiAccessMode getModelAccessMode(const OdAnsiString &modelName=REPOSITORY_DEFAULE_MODEL_NAME) const
OdDAI::Repository::readHeaderSection
static OdHeaderSectionPtr readHeaderSection(OdStreamBufPtr pStream)
OdDAI::Repository::m_name
OdString m_name
Definition: daiRepository.h:203
OdDAI::SchemaPtr
OdSmartPtr< Schema > SchemaPtr
Definition: daiRepository.h:50
SmartPtr.h
OdDAI::OdHeaderSectionPtr
OdSmartPtr< OdHeaderSection > OdHeaderSectionPtr
Definition: daiHeaderSection.h:35
OdDAI::SessionInstance
Definition: daiSessionInstance.h:38
OdDAI::Repository::getHeaderSection
OdHeaderSectionPtr getHeaderSection()
OdDAI::Repository::writeFile
virtual OdResult writeFile(const OdString &filename, bool saveLogFile=false)
OdDAI::Repository::initialize
OdResult initialize()
OdDAI::Repository::getModel
const ModelPtr getModel(ModelPtr &modelPtr) const
OdDAI::Repository::readFile
OdResult readFile(const OdString &fileName)
daiSessionInstance.h
sdai.h
OdDAI::Repository::readHeaderSection
static OdHeaderSectionPtr readHeaderSection(const OdString &fileName)
DAI_EXPORT
#define DAI_EXPORT
Definition: daiBuildOptions.h:28
OdDAI::RepositoryPtr
OdSmartPtr< Repository > RepositoryPtr
Definition: daiRepository.h:213