XDocument

Inherited from NULL

Inherited by NULL

Friend class NULL

Description

XDocument是XT框架中的数据中心,它构建了一个应用空间,应用空间的基础是它所管理的数据对象管理器(XManager),而数据对象管理器则负责具体对象(XItem)的创建、修改与删除,因此可将XDocument看作是数据的树根,由根长出树干(数据对象管理器),再由树干长出树枝树叶(数据对象)。应用程序要完成哪些工作,这些决定了应用空间里应该管理哪些数据。在文档的初始化过程(init())中,应逐项加入数据对象管理器,只有加入到文档的数据对象管理器才能被功能接口访问进而根据需要创建、销毁或者修改指定类型的数据对象。
在XDocument中构建的任何数据对象都可以通过下面的步骤访问:

  1. 通过对象的类型调用XDocument的getItemManager获取对象管理器;
  2. 通过对象的ID调用XManager的getItem获取对象指针;

这种访问方式适用于任何基于XDocument继承的应用,因此在编写应用功能函数时可以使用通用的接口函数形式而无需考虑具体的应用。
一般来说,XDocument会保有一份视图数据(XViewData)以记录文档当前的状态并组织成易于展示的形式。

Members

Public interface

Protected interface


int m_ulDocType 文档类型,注册时由程序自动生成,注册功能命令时需要用到。

int m_bModified 文档是否发生修改的标识位

int64 m_CreateTime

int64 m_LastModifyTime

bool m_bEnableUndo 文档是否支持Undo/Redo操作

XTree * m_pTree 文档对象树,用于构建对象树视图

XTree * m_pSecondTree

XMemPool * m_pDocMem 文档的内存池

Name m_strGUID 文档的GUID标识符,与文档类型一一对应

Name m_strDocName 文档名,不超过64个字符

Name m_strVender

Name m_strExtension

DBVersion m_Version

int m_iDocIndex

Path m_strDocPath 文档路径,不超过256个字符

unordered_map<void *, BranchInfo> * m_pBranchNameMap

vector<XSession*> m_pSessions

vector<XManager*> m_pMgrs

unordered_map<string, TypeID> * m_pTreeNodeMap

int m_iNextTreeNodeType

Path m_strLogFile 应用文档的日志文件名,不超过256个字符

const XUnitSystem * m_pDocUnitSys

OpnRecorder * m_pDocRecord 记录文档操作中数据的修改(包括增加、删除)


XDocument()

void setName(const char * dname)

const char * getExtension()

const char * getName()

const char * getPath()

const char * getGUID()

const char * getDocIDString()

const DBVersion & getVersion()

void setVersion(int major, int minor, int sub, int build)

const char * getVender()

void setVender(const char * s)

XSession * getSession(const char * name)

int64 getCreateTime() const

int64 getModifyTime() const

virtual void save(const char * fname, const char * scheme)

virtual bool load(const char * fname)

virtual void saveH5(const char * fname, const char * scheme)

virtual bool loadH5(const char * fname)

virtual void reset()

virtual bool isEmpty() const

virtual void clear()

virtual bool isClosable()

virtual void buildObjectTree()

XTree * getObjectTree()

XTree * getSecondTree()

void updateDomainTree(XManager * mgr, const char * branchName = NULL, TypeID domainType = Domain_Unknown, TreeNode * category = NULL)

TreeNode * updateModelPartTree(const XPart * p, bool bDelete)

virtual TreeNode * updateObjectTree(const XItem * obj, bool bDelete = false)

virtual TreeNode * updateSecondTree(const XItem * obj, bool bDelete = false)

TypeID ctype() const

const char * ctypeString() const

virtual void release()

virtual void init()

bool isModified()

void setModified(bool b)

void saveConfig(const char * scheme)

void loadConfig(const char * scheme)

virtual void registerEnumString()

XMemPool * getDocMem()

virtual const char * getExtensionNames()

void setLogFile(const char * name)

void enableUndo()

void disableUndo()

virtual void clearCacheData()

virtual void clearReference(const XItem* obj)

void setUnitSystem(const XUnitSystem * unitSys)

const XUnitSystem * getUnitSystem()

virtual XViewData * getViewData()

virtual const XItem *getItem(TypeID tid, ulong id, DomainID did)

virtual const XItem *getItem(const XUniqueObjectID * ue)

virtual XModel * getModel()

XManager * getItemManager(TypeID mgrType)

void insertItemManager(XManager * mgr)

void createMaterialManager()

void createPropertyManager(XModel * mdl)

void createConditionManager()

void createJobManager()

virtual void getItemInformation(const XUniqueObjectID * ue, string * infoStr)

virtual void getItemTargets(const XItem* item, vector<XUniqueObjectID> * ues)

virtual void setItemTargets(const XItem* item, vector<XUniqueObjectID> * ues)

virtual void createViewData()

TreeNode * findLeafNode(TreeNode * branchNode, TreeNodeData leafObj)

TreeNode * getTreeItem(TreeNodeData domain, TreeNodeData obj, bool bSecondTree = false)

TreeNode * getTreeItem(XManager * domain, TreeNodeData obj, bool bSecondTree = false)

virtual bool checkNodeStatus(TreeNode * node)

TreeNode * getBranchNode(TreeNodeData branchObj, bool bSecondTree = false)

OpnRecorder * getRecorder()

void getDocTempFilePath(const char * file, string * strPath)

void exchangeJsonItems(vector<const XItem*> * items, JsonParams * parr, const char * key, int domanID = 0)

static TypeID registerDocument(const char * docString, CreateDocFunc cfunc = 0, DestroyDocFunc dfunc = 0, TypeID docType = Document_None)

static bool registerUIProxy(TypeID docID, CreateUIProxyFunc cUIFunc, DestroyUIProxyFunc dUIFunc)

static bool registerSession(const char * sname, FuncCreateSession cFunc, FuncDestroySession dFunc)

static bool queryDocumentTypes(vector<string> * docTypes)

static const char * getDocumentTypeString(TypeID docID)

static TypeID getDocumentTypeID(const char * docString)

static XDocument * create(const char * docString)

static void destroy(XDocument *)

static UIProxy * createUIProxy(MainFrame * mf, XDocument * doc)

static void destroyUIProxy(TypeID docID, UIProxy *)

static const char * resolveDocumentType(const char * fname)

static XSession * createSession(const char * sname)

static void destroySession(XSession * session)

virtual ResultIndexMap * getResultIndexMap(XModel * mesh)

void registerTreeNodeType(const char * tString)

TypeID getTreeNodeType(const char * tString)

bool getModelSheet(const XModel * obj, vector<ObjPropertyEntry> * prpSheet, bool bMesh)

bool getPartSheet(const XPart * obj, vector<ObjPropertyEntry> * prpSheet, bool bMesh)

bool getAssemblySheet(const XAssembly * obj, vector<ObjPropertyEntry> * prpSheet, bool bMesh)

bool getShapeSheet(const XGeometry * obj, vector<ObjPropertyEntry> * prpSheet)

bool getNodeSheet(const XNode * obj, vector<ObjPropertyEntry> * prpSheet)

bool getElementSheet(const XElement * obj, vector<ObjPropertyEntry> * prpSheet)

bool updateExternalReference(const char * extpath)


TreeNode * updateItemTree(XManager * mgr, const XItem * obj, bool bDelete = false)

void updateDocFolder()

void saveHeader(XBinaryIO * io, const char * scheme)

bool loadHeader(XBinaryIO * io)

void saveHeader(XH5IO * io, const char * scheme, H5Object * hroot)

bool loadHeader(XH5IO * io, H5Object * hroot)