CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
MaterialResolver.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
25#ifndef _OD_MATERIALRESOLVER_INCLUDED_
26#define _OD_MATERIALRESOLVER_INCLUDED_
27
28#include "TD_PackPush.h"
29
30#define STL_USING_MAP
31#include "OdaSTL.h"
32
33#include "DbBaseDatabase.h"
34
38{
39public:
40 typedef std::map<OdUInt64 /*materialId*/, OdUInt64 /*objectId*/> OdIdIdMap;
41
42private:
43 OdDbBaseDatabase *m_pDb;
44 OdIdIdMap m_Map;
45
46public:
47
49 : m_pDb(0)
50 {
51 }
52
54 : m_pDb(resolver.m_pDb)
55 , m_Map(resolver.m_Map)
56 {
57 }
58
60 : m_pDb(0)
61 , m_Map(map)
62 {
63 }
64
66 {
67 return m_pDb;
68 }
69
71 {
72 m_pDb = pDb;
73 }
74
76 {
77 return m_Map;
78 }
79
80 const OdIdIdMap &map() const
81 {
82 return m_Map;
83 }
84
85 void clear()
86 {
87 m_pDb = 0;
88 m_Map.clear();
89 }
90
91 bool isEmpty() const
92 {
93 return m_pDb == 0 && m_Map.size() == 0;
94 }
95
96 bool getPair(OdUInt64 id, OdUInt64 &pair) const
97 {
98 OdIdIdMap::const_iterator pIt = m_Map.find(id);
99 if (pIt == m_Map.end())
100 {
101 return false;
102 }
103
104 pair = pIt->second;
105 return true;
106 }
107
108};
109
110#include "TD_PackPop.h"
111
112#endif // _OD_MATERIALRESOLVER_INCLUDED_
#define DBROOT_EXPORT
Definition: DbRootExport.h:39
OdDbBaseDatabase * database() const
std::map< OdUInt64, OdUInt64 > OdIdIdMap
OdMaterialResolver(const OdMaterialResolver &resolver)
void setDatabase(OdDbBaseDatabase *pDb)
const OdIdIdMap & map() const
OdMaterialResolver(OdDbBaseDatabase *pDb, const OdIdIdMap &map)
bool getPair(OdUInt64 id, OdUInt64 &pair) const
bool isEmpty() const