summaryrefslogtreecommitdiffstats
path: root/sdo-cpp/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/Type.h
blob: e0b56a12b92faf5eb153abaf8c70366c4b1f7074 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 *   
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

/* $Rev$ $Date$ */

#ifndef _SDO_TYPE_H_
#define _SDO_TYPE_H_


#include "commonj/sdo/export.h"

#include "commonj/sdo/PropertyList.h"
#include "commonj/sdo/SDOString.h"


namespace commonj{
namespace sdo{




class Property;

    /**  
     * 
     * Type is a representation of the type of a property of a data object.
     */

class Type
{

public:


/** \enum Types
 *
 * This is the enumerator for all DataType types. All DataObjectType types
 * appear as a Type::Types of DataObjectType.
 * otherTypes, ChangeSumamryType and TextType are not used by client code.
 */


   SDO_API enum Types
   {
    // Zero is a value for 'unknown type; - all data objects'
    OtherTypes = 0,
    BigDecimalType, 
    BigIntegerType, 
    BooleanType,   
    ByteType,
    BytesType,
    CharacterType,
    DateType,      
    DoubleType,    
    FloatType,    
    IntegerType, 
    LongType,      
    ShortType,     
    StringType,    
    UriType,
    DataObjectType,
    ChangeSummaryType,
    TextType,
    OpenDataObjectType,
    num_types
   };

    virtual SDO_API ~Type();

    /**  getName returns the name of the type
     *
     * This method returns a const char* name of the type.
     */

    virtual SDO_API const char* getName() const = 0;
  
    /**  getAlias returns the n'th alias
     *
     * This method returns a const char* corresponding to the
     * alias at index n of the list of aliases. Use getAliasCount to 
     * discover the size of the list.
     */

    virtual SDO_API const char* getAlias(unsigned int index = 0) const = 0;

    /**  getAliasCount  returns the number of aliases
     *
     * This method returns the number of aliases for this type
     */

    virtual SDO_API unsigned int getAliasCount() const = 0;

    /**  getBaseType returns the base if there is one
     *
     * This method returns a const Type* corresponding to the
     * base Type for this type. The base type is the one which
     * this type inherits from.
     */
    
    virtual SDO_API const Type* getBaseType() const = 0;

    /**  getURI  returns the URI for this type
     *
     * This method returns the URI for this type. The URI may be
     * null.
     */

    virtual SDO_API const char* getURI() const = 0;



    /**  getProperties returns a list of properties for this type
     *
     * This method returns the list of properties for this type. 
     * Instances of open types may have more properties than appear
     * in this list.
     * See the propertylist API.
     */

    virtual SDO_API PropertyList  getProperties() const = 0;
    virtual SDO_API const std::list<PropertyImpl*>& getPropertyListReference() const = 0;

 
    /**  getProperty returns a property for this type
     *
     * This method returns a property, by index or by name
     */

    virtual SDO_API const Property& getProperty(const char* propertyName)  const = 0;
    virtual SDO_API const Property& getProperty(const SDOString& propertyName) const = 0;
    virtual SDO_API const Property& getProperty(unsigned int index)  const = 0;

    /**  getPropertyIndex returns an index 
     *
     * This method returns a property index for a named property
     */

    virtual SDO_API unsigned int getPropertyIndex(const char* propertyName) const  = 0;
    virtual SDO_API unsigned int getPropertyIndex(const SDOString& propertyName) const = 0;
 
    /**  isDataObjectType true if not a DataType 
     *
     * This method returns true if the type is not a DataType, and is therefore
     * a DataObjectType with properties.
     */

    virtual SDO_API bool isDataObjectType() const = 0;
  

    /**  isSequencedType true if the type is sequenced 
     *
     * This method returns true if the type is sequenced, and is therefore
     * objects of this type can be manipulate via their sequence interface.
     */

    virtual SDO_API bool isSequencedType() const = 0;


    /**  isOpenType true if the type is open 
     *
     * Normal types have a predefined list of properties. Trying to set 
     * properties which do not exist will cause an exception to be thrown.
     * Open types, on the other hand, may have properties added to their 
     * instances runtime. These properties get added silently when setting a
     * property value for a property which does not exist.
     * Different instances of these objects may have different lists of 
     * open properties.
     */

    virtual SDO_API bool isOpenType() const = 0;

    /**  isAbstractType true if the type is not instantiable. 
     *
     * An abstract type may not be instantiated. It is useful only as 
     * a base type to some other non-abstract type.
     */

    virtual SDO_API bool isAbstractType() const = 0;

    /**  isDataType true if the type is not an object. 
     *
     * A DataType is anything which is not a DataObjectType. This method
     * is the opposite of isDataObjectType().
     */

    virtual    SDO_API bool isDataType() const = 0;


    /**  isChangeSummaryType true if the type is a change summary. 
     *
     * There is only one type called ChangeSummary. This method serves
     * no purpose in the C++ implementation.
     */

    virtual    SDO_API bool isChangeSummaryType() const = 0;

    /**  getTypeEnum gets the enum for this type. 
     *
     * Each DataType has a defined value in the list of Types.
     */

    virtual    SDO_API Type::Types getTypeEnum() const = 0;

    /**  equals compares uri and name. 
     *
     * The types are equal if the URI and Name are equal.
     */

    virtual SDO_API bool equals(const Type& tother) const = 0;

    static SDO_API const SDOString SDOTypeNamespaceURI;
};

};
};
#endif //_SDO_TYPE_H_