CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
DbEvalGraph.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, 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-2022 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 _DbEvalGraph_h_Included_
25#define _DbEvalGraph_h_Included_
26
27#include "SmartPtr.h"
28#include "DbObject.h"
29
30#include "TD_PackPush.h"
31
32// Forward class declarations
33
34class OdDbEvalGraph;
36class OdDbEvalExpr;
38class OdDbEvalContext;
41class OdResBuf;
42class OdDbImpEvalContext;
43class OdDbImpEvalContextIterator;
44
49
54
59
60typedef unsigned long OdDbEvalNodeId;
61
78
79#include "OdPlatformSettings.h"
80#include "StringArray.h"
81
82#ifdef DYNBLOCKS_DLL_EXPORTS
83#ifndef SWIG
84#define DYNBLOCKS_EXPORT OD_TOOLKIT_EXPORT
85#else
86#define DYNBLOCKS_EXPORT
87#endif
88#define DYNBLOCKS_EXPORT_STATIC OD_STATIC_EXPORT
89#else
90#ifndef SWIG
91#define DYNBLOCKS_EXPORT OD_TOOLKIT_IMPORT
92#else
93#define DYNBLOCKS_EXPORT
94#endif
95#define DYNBLOCKS_EXPORT_STATIC OD_STATIC_IMPORT
96#endif
97
103{
104public:
109 virtual ~OdDbEvalIdMap() {};
110
117 virtual OdDbEvalNodeId find(const OdDbEvalNodeId& key) = 0;
118
122 virtual void kill() = 0;
123};
124
125
150{
151public:
152
153 enum NodeId {
154 kNullNodeId = 0
155 };
156
158
160 virtual ~OdDbEvalGraph();
161
162 /* Management */
163
169 static bool hasGraph(const OdDbObject* pObj,
170 const OdString& key);
171
179 const OdString& pKey,
180 const OdDb::OpenMode openMode = OdDb::kForRead );
181
182
192 static bool createGraph(OdDbObject* pObj,
193 const OdString& key);
194
195
203 static bool removeGraph(OdDbObject* pObj,
204 const OdString& pKey);
205
211 static bool hasGraph(OdDbDatabase* pDb,
212 const OdString& key);
213
222 const OdString& key,
223 const OdDb::OpenMode openMode = OdDb::kForRead );
224
234 static bool createGraph(OdDbDatabase* pDb,
235 const OdString& key);
236
244 static bool removeGraph(OdDbDatabase* pDb,
245 const OdString& key);
246
258
266 virtual bool removeNode (const OdDbEvalNodeId& nodeId);
267
275 virtual bool removeNode (OdDbEvalExpr* pNode);
276
281 virtual void getAllNodes (OdDbEvalNodeIdArray& allNodes) const;
282
288 virtual OdDbEvalExprPtr getNode( const OdDbEvalNodeId& nodeId, OdDb::OpenMode openMode = OdDb::kForRead ) const;
289
290
303 virtual bool addEdge(const OdDbEvalNodeId& idFrom,
304 const OdDbEvalNodeId& idTo);
305
317 virtual bool addEdge(const OdDbEvalNodeId& idFrom,
318 const OdDbEvalNodeId& idTo,
319 bool invertible);
320
321
334 virtual bool removeEdge(const OdDbEvalNodeId& idFrom,
335 const OdDbEvalNodeId& idTo);
336
343 virtual void getIncomingEdges(const OdDbEvalNodeId& nodeId,
344 OdDbEvalEdgeInfoArray& edges) const;
345
352 virtual void getOutgoingEdges(const OdDbEvalNodeId& nodeId,
353 OdDbEvalEdgeInfoArray& edges) const;
354
355
364 virtual bool getEdgeInfo(const OdDbEvalNodeId& idFrom,
365 const OdDbEvalNodeId& idTo, OdDbEvalEdgeInfo& edgeInfo) const;
366
367
374 virtual void addGraph(OdDbEvalGraph* pGraphToAdd, OdDbEvalIdMap*& idMap);
375
376 /* Evaluation */
377
394 virtual bool evaluate() const;
395
401 virtual bool evaluate(
402 const OdDbEvalContext* pContext) const;
403
410 virtual bool evaluate(
411 const OdDbEvalContext* pContext,
412 const OdDbEvalNodeIdArray* pActivateNodes) const;
413
414
426 virtual bool activate(
427 const OdDbEvalNodeIdArray& activatedNodes) const;
428
429
436 virtual bool activate(
437 const OdDbEvalNodeIdArray& activatedNodes,
438 OdDbEvalNodeIdArray* pActiveSubgraph) const;
439
445 virtual bool activate(
446 const OdDbEvalNodeIdArray& activatedNodes,
447 OdDbEvalNodeIdArray* pActiveSubgraph,
448 OdDbEvalNodeIdArray* pCycleNodes) const;
449
450
460 virtual bool getIsActive(const OdDbEvalNodeId& nodeId,
461 bool& isActive) const;
462
473 virtual bool equals(const OdDbEvalGraph* pOther) const;
474
475
481 virtual bool isSubgraphOf(const OdDbEvalGraph* pOther) const;
482
484 virtual void dwgOutFields(OdDbDwgFiler* pFiler) const ODRX_OVERRIDE;
486 virtual void dxfOutFields(OdDbDxfFiler* pFiler) const ODRX_OVERRIDE;
487 virtual void applyPartialUndo(OdDbDwgFiler* pFiler, OdRxClass* pClassObj) ODRX_OVERRIDE;
488 virtual void copyFrom(const OdRxObject* p) ODRX_OVERRIDE;
490 virtual void subHandOverTo(
491 OdDbObject* pNewObject) ODRX_OVERRIDE;
492};
493
494
510{
511public:
513 : mFlags(0), mRefCount(0)
514 {
517 }
518
525 OdDbEvalNodeId toId,
526 long flags,
527 unsigned long count)
528 : mIdFrom(fromId), mIdTo(toId), mFlags(flags), mRefCount(count)
529 {}
530
535
543 unsigned long refCount() const;
544
551 bool isInvertible () const;
558 bool isSuppressed () const;
559
560 bool operator == (const OdDbEvalEdgeInfo& other) const;
561
562private:
563 OdDbEvalNodeId mIdFrom;
564 OdDbEvalNodeId mIdTo;
565 long mFlags;
566 unsigned long mRefCount;
567};
568
569
589{
590public:
592
594 virtual ~OdDbEvalExpr();
595
605
615
626 virtual void addedToGraph (OdDbEvalGraph* pGraph);
627
638 virtual void removedFromGraph (OdDbEvalGraph* pGraph);
639
640
652 virtual void adjacentNodeRemoved (const OdDbEvalNodeId& adjNodeId);
653
654
665 virtual void adjacentEdgeRemoved (const OdDbEvalNodeId& adjEdgeNodeId);
666
667
681 virtual void adjacentEdgeAdded (const OdDbEvalNodeId& fromId,
682 const OdDbEvalNodeId& toId,
683 bool isInvertible);
684
685
697 virtual void movedFromGraph (OdDbEvalGraph* pFromGraph);
698
710 virtual void movedIntoGraph (OdDbEvalGraph* pIntoGraph);
711
712
713
725 virtual void copiedIntoGraph(OdDbEvalGraph* pIntoGraph);
726
733 virtual bool isActivatable () const;
734
747 virtual void activated (OdDbEvalNodeIdArray& argumentActiveList);
748
759 virtual void graphEvalStart (bool nodeIsActive);
760
761
772 virtual void graphEvalEnd(bool nodeIsActive);
773
784 virtual void graphEvalAbort(bool nodeIsActive);
785
797 virtual bool evaluate(const OdDbEvalContext* evalContext);
798
807 virtual bool equals(const OdDbEvalExpr* pOther) const;
808
815
821 virtual void remappedNodeIds(
822 OdDbEvalIdMap& idMap
823 );
824
825
827 void dwgOutFields(OdDbDwgFiler* pFiler) const;
829 void dxfOutFields(OdDbDxfFiler* pFiler) const;
831
832protected:
833
835 friend class OdDbEvalExprImpl;
836};
837
838
854{
855public:
857
859
864 virtual void getConnectionNames (OdStringArray& connectionNames) const;
865
870 virtual bool hasConnectionNamed (const OdString& connectionName) const;
871
872
880 virtual bool getConnectionType (
881 const OdString& connectionName,
882 OdResBuf::ValueType& connectionType) const;
883
884
891 virtual OdResBufPtr getConnectionValue( const OdString& connectionName) const;
892
893
901 virtual bool setConnectionValue ( const OdString& connectionName, const OdResBuf* pValue);
902
903
916 virtual bool connectTo (
917 const OdString& thisConnectionName,
918 OdDbEvalNodeId sourceConnectableId,
919 const OdString& sourceConnectionName);
920
921
934 virtual bool disconnectFrom (
935 const OdString& thisConnectionName,
936 OdDbEvalNodeId sourceConnectableId,
937 const OdString& sourceConnectionName);
938
950 virtual bool connectionAllowed (
951 const OdString& thisConnectionName,
952 OdDbEvalNodeId sourceConnectableId,
953 const OdString& sourceConnectionName) const;
954
955
965 virtual bool getConnectedObjects (
966 const OdString& thisConnectionName,
967 OdDbEvalNodeIdArray& connectedObjects) const;
968
979 virtual bool getConnectedNames (
980 const OdString& thisConnectionName,
981 OdDbEvalNodeId sourceConnectableId,
982 OdStringArray& sourceConnectionNames) const;
983protected:
984
986};
987
992
1012{
1013public:
1014
1016
1017
1019
1021
1022
1029 virtual void insertAt (const OdDbEvalContextPair& pair);
1030
1031
1036 virtual void removeAt (const OdString& key);
1037
1038
1050 virtual bool getAt (OdDbEvalContextPair& pair) const;
1051
1052
1057
1058private:
1059 OdDbImpEvalContext* m_pImp;
1060 friend class OdDbImpEvalContextIterator;
1061};
1062
1082{
1083public:
1084
1086
1091
1093
1098 void setKey (const OdString& key);
1099
1104 const OdString key () const;
1105
1113 void setValue (void* value);
1114
1119 void* value () const;
1120
1121private:
1122 OdString mKey;
1123 void* mValue;
1124};
1125
1126
1145{
1146public:
1148
1150
1152
1159 virtual void start();
1160
1164 virtual bool next();
1165
1169 virtual bool done() const;
1170
1175
1176private:
1177 OdDbImpEvalContextIterator* m_pImp;
1178 friend class OdDbImpEvalContext;
1179};
1180
1181#include "TD_PackPop.h"
1182
1183#endif
OdArray< OdDbEvalEdgeInfo > OdDbEvalEdgeInfoArray
Definition: DbEvalGraph.h:69
OdSmartPtr< OdDbEvalConnectable > OdDbEvalConnectablePtr
Definition: DbEvalGraph.h:991
OdSmartPtr< OdDbEvalGraph > OdDbEvalGraphPtr
Definition: DbEvalGraph.h:48
OdArray< OdDbEvalNodeId, OdMemoryAllocator< OdDbEvalNodeId > > OdDbEvalNodeIdArray
Definition: DbEvalGraph.h:65
#define DYNBLOCKS_EXPORT
Definition: DbEvalGraph.h:91
OdArray< OdDbEvalExprPtr > OdDbEvalExprPtrArray
Definition: DbEvalGraph.h:73
OdSmartPtr< OdDbEvalContextIterator > OdDbEvalContextIteratorPtr
Definition: DbEvalGraph.h:53
unsigned long OdDbEvalNodeId
Definition: DbEvalGraph.h:60
OdSmartPtr< OdDbEvalExpr > OdDbEvalExprPtr
Definition: DbEvalGraph.h:58
OdArray< OdResBufPtr > OdResBufArray
Definition: DbEvalGraph.h:77
bool operator==(T left, const OdGiVariant::EnumType right)
Definition: GiVariant.h:397
#define ODRX_OVERRIDE
OdResult
Definition: OdResult.h:29
virtual void getConnectionNames(OdStringArray &connectionNames) const
virtual bool disconnectFrom(const OdString &thisConnectionName, OdDbEvalNodeId sourceConnectableId, const OdString &sourceConnectionName)
virtual bool getConnectionType(const OdString &connectionName, OdResBuf::ValueType &connectionType) const
ODDB_DECLARE_MEMBERS(OdDbEvalConnectable)
virtual bool connectionAllowed(const OdString &thisConnectionName, OdDbEvalNodeId sourceConnectableId, const OdString &sourceConnectionName) const
virtual bool getConnectedObjects(const OdString &thisConnectionName, OdDbEvalNodeIdArray &connectedObjects) const
virtual bool hasConnectionNamed(const OdString &connectionName) const
virtual bool connectTo(const OdString &thisConnectionName, OdDbEvalNodeId sourceConnectableId, const OdString &sourceConnectionName)
virtual ~OdDbEvalConnectable()
virtual OdResBufPtr getConnectionValue(const OdString &connectionName) const
virtual bool getConnectedNames(const OdString &thisConnectionName, OdDbEvalNodeId sourceConnectableId, OdStringArray &sourceConnectionNames) const
virtual bool setConnectionValue(const OdString &connectionName, const OdResBuf *pValue)
virtual bool getAt(OdDbEvalContextPair &pair) const
virtual void insertAt(const OdDbEvalContextPair &pair)
virtual void removeAt(const OdString &key)
virtual OdDbEvalContextIteratorPtr newIterator() const
virtual ~OdDbEvalContext()
ODRX_DECLARE_MEMBERS(OdDbEvalContext)
virtual OdDbEvalContextPair contextPair() const
ODRX_DECLARE_MEMBERS(OdDbEvalContextIterator)
virtual bool done() const
virtual ~OdDbEvalContextIterator()
virtual void start()
const OdString key() const
void * value() const
OdDbEvalContextPair(const OdString &key, void *value)
virtual ~OdDbEvalContextPair()
void setKey(const OdString &key)
void setValue(void *value)
OdDbEvalNodeId from() const
bool isInvertible() const
OdDbEvalNodeId to() const
unsigned long refCount() const
OdDbEvalEdgeInfo(OdDbEvalNodeId fromId, OdDbEvalNodeId toId, long flags, unsigned long count)
Definition: DbEvalGraph.h:524
bool isSuppressed() const
virtual void activated(OdDbEvalNodeIdArray &argumentActiveList)
virtual void adjacentEdgeAdded(const OdDbEvalNodeId &fromId, const OdDbEvalNodeId &toId, bool isInvertible)
OdResBufPtr m_lastValue
Definition: DbEvalGraph.h:834
virtual void copiedIntoGraph(OdDbEvalGraph *pIntoGraph)
OdResult dwgInFields(OdDbDwgFiler *pFiler)
virtual void remappedNodeIds(OdDbEvalIdMap &idMap)
virtual void adjacentNodeRemoved(const OdDbEvalNodeId &adjNodeId)
virtual ~OdDbEvalExpr()
OdResult dxfInFields(OdDbDxfFiler *pFiler)
virtual void adjacentEdgeRemoved(const OdDbEvalNodeId &adjEdgeNodeId)
virtual void addedToGraph(OdDbEvalGraph *pGraph)
OdDbEvalNodeId nodeId() const
virtual void graphEvalEnd(bool nodeIsActive)
OdResBufPtr value() const
virtual bool isActivatable() const
OdDbEvalGraphPtr getGraph(OdDb::OpenMode openMode=OdDb::kForRead) const
virtual void movedFromGraph(OdDbEvalGraph *pFromGraph)
void dxfOutFields(OdDbDxfFiler *pFiler) const
virtual bool equals(const OdDbEvalExpr *pOther) const
void dwgOutFields(OdDbDwgFiler *pFiler) const
ODDB_DECLARE_MEMBERS(OdDbEvalExpr)
virtual OdResult postInDatabase(OdDbDatabase *)
virtual bool evaluate(const OdDbEvalContext *evalContext)
virtual void graphEvalAbort(bool nodeIsActive)
virtual void movedIntoGraph(OdDbEvalGraph *pIntoGraph)
virtual void graphEvalStart(bool nodeIsActive)
virtual void removedFromGraph(OdDbEvalGraph *pGraph)
virtual void addGraph(OdDbEvalGraph *pGraphToAdd, OdDbEvalIdMap *&idMap)
virtual OdResult dwgInFields(OdDbDwgFiler *pFiler) ODRX_OVERRIDE
virtual bool isSubgraphOf(const OdDbEvalGraph *pOther) const
virtual bool activate(const OdDbEvalNodeIdArray &activatedNodes, OdDbEvalNodeIdArray *pActiveSubgraph, OdDbEvalNodeIdArray *pCycleNodes) const
virtual bool evaluate(const OdDbEvalContext *pContext, const OdDbEvalNodeIdArray *pActivateNodes) const
virtual void getOutgoingEdges(const OdDbEvalNodeId &nodeId, OdDbEvalEdgeInfoArray &edges) const
virtual bool addEdge(const OdDbEvalNodeId &idFrom, const OdDbEvalNodeId &idTo)
virtual bool activate(const OdDbEvalNodeIdArray &activatedNodes) const
virtual bool addEdge(const OdDbEvalNodeId &idFrom, const OdDbEvalNodeId &idTo, bool invertible)
static bool removeGraph(OdDbObject *pObj, const OdString &pKey)
virtual void getAllNodes(OdDbEvalNodeIdArray &allNodes) const
virtual bool getEdgeInfo(const OdDbEvalNodeId &idFrom, const OdDbEvalNodeId &idTo, OdDbEvalEdgeInfo &edgeInfo) const
virtual OdResult dxfInFields(OdDbDxfFiler *pFiler) ODRX_OVERRIDE
virtual bool equals(const OdDbEvalGraph *pOther) const
virtual ~OdDbEvalGraph()
virtual void dxfOutFields(OdDbDxfFiler *pFiler) const ODRX_OVERRIDE
virtual bool removeNode(const OdDbEvalNodeId &nodeId)
virtual bool getIsActive(const OdDbEvalNodeId &nodeId, bool &isActive) const
virtual void getIncomingEdges(const OdDbEvalNodeId &nodeId, OdDbEvalEdgeInfoArray &edges) const
virtual bool activate(const OdDbEvalNodeIdArray &activatedNodes, OdDbEvalNodeIdArray *pActiveSubgraph) const
virtual bool removeEdge(const OdDbEvalNodeId &idFrom, const OdDbEvalNodeId &idTo)
virtual OdDbEvalNodeId addNode(OdDbEvalExpr *pNode)
ODDB_DECLARE_MEMBERS(OdDbEvalGraph)
virtual void copyFrom(const OdRxObject *p) ODRX_OVERRIDE
virtual void subHandOverTo(OdDbObject *pNewObject) ODRX_OVERRIDE
static bool removeGraph(OdDbDatabase *pDb, const OdString &key)
static OdDbEvalGraphPtr getGraph(OdDbDatabase *pDb, const OdString &key, const OdDb::OpenMode openMode=OdDb::kForRead)
virtual OdDbEvalExprPtr getNode(const OdDbEvalNodeId &nodeId, OdDb::OpenMode openMode=OdDb::kForRead) const
virtual void applyPartialUndo(OdDbDwgFiler *pFiler, OdRxClass *pClassObj) ODRX_OVERRIDE
static bool createGraph(OdDbDatabase *pDb, const OdString &key)
virtual void dwgOutFields(OdDbDwgFiler *pFiler) const ODRX_OVERRIDE
virtual bool removeNode(OdDbEvalExpr *pNode)
virtual bool evaluate() const
static bool hasGraph(OdDbDatabase *pDb, const OdString &key)
virtual OdResult postInDatabase(OdDbDatabase *)
static OdDbEvalGraphPtr getGraph(const OdDbObject *pObj, const OdString &pKey, const OdDb::OpenMode openMode=OdDb::kForRead)
virtual bool evaluate(const OdDbEvalContext *pContext) const
static bool createGraph(OdDbObject *pObj, const OdString &key)
static bool hasGraph(const OdDbObject *pObj, const OdString &key)
virtual OdDbEvalNodeId find(const OdDbEvalNodeId &key)=0
virtual void kill()=0
virtual ~OdDbEvalIdMap()
Definition: DbEvalGraph.h:109
ValueType
Definition: ResBuf.h:167
GLsizei GLsizei * count
Definition: gles2_ext.h:276
GLsizei const GLfloat * value
Definition: gles2_ext.h:302
OpenMode
Definition: DbObjectId.h:54
@ kForRead
Definition: DbObjectId.h:56