summaryrefslogtreecommitdiffstats
path: root/sdo-cpp/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/DataObjectImpl.h
blob: 9162b95a3b829f591e68889e0a4f99fd2119d32d (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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
/*
 * 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 _DATAOBJECTIMPL_H_
#define _DATAOBJECTIMPL_H_
#include "commonj/sdo/DataObject.h"

#include "commonj/sdo/disable_warn.h"

#include <ctime>
#include <list>
#include <map>

#include <string>


#include "commonj/sdo/Property.h"
#include "commonj/sdo/TypeImpl.h"
#include "commonj/sdo/DataFactory.h"
#include "commonj/sdo/SequenceImpl.h"
#include "commonj/sdo/DataObjectListImpl.h"
#include "commonj/sdo/PropertyList.h"

#include "commonj/sdo/RefCountingPointer.h"
#include "commonj/sdo/ChangeSummaryImpl.h"
#include "commonj/sdo/SDODate.h"
#include "commonj/sdo/SDOValue.h"

namespace commonj{
namespace sdo{
    
class DataGraph;
class DataObjectImpl; 
class DataObjectListImpl;
class DataFactory;


#define DataObjectImplPtr RefCountingPointer<DataObjectImpl>
#define ChangeSummaryImplPtr RefCountingPointer<ChangeSummaryImpl>

/**
 * rdo is an internal class holding a property value in a data object.
 */

class rdo {
public:
    unsigned int first;
    DataObjectImplPtr second;
    rdo(unsigned int infirst, DataObjectImpl* insecond);
    rdo();
    rdo (const rdo& inrdo);
    virtual ~rdo();
};

typedef std::list< rdo > PropertyValueMap;


 /**  
  *  DataObjectImpl implements the abstract class DataObject.
  *
  * A data object is a representation of some structured data. 
  * it is the fundamental component in the SDO (Service Data Objects) package.
  * Data objects support reflection, path-based accesss, convenience creation 
  * and deletion methods,and the ability to be part of a data graph.
  * Each data object holds its data as a series of properties. 
  * Properties can be accessed by name, property index, or using the property 
  * meta object itself. 
  * A data object can also contain references to other data objects, through 
  * reference-type properties.
  * A data object has a series of convenience accessors for its properties. 
  * These methods either use a path (String), a property index, 
  * or the property's meta object itself, to identify the property.
  * Some examples of the path-based accessors are as follows:
  * DataObjectPtr company = ...;
  * company->getString("name");                   
  * company->setString("name", "acme");
  * company->getString("department.0/name")       
  *                                        .n  indexes from 0.
  * company->getString("department[1]/name")      [] indexes from 1.
  * company->getDataObject("department[number=123]")  returns the department where number=123
  * company->getDataObject("..")                      returns the containing data object
  * company->getDataObject("/")                       returns the root containing data object
  * There are specific accessors for the primitive types and commonly used 
  * data types like String.
  */

class DataObjectImpl : public DataObject
{
     public:

    DataObjectImpl();
    DataObjectImpl(const TypeImpl& t);
    DataObjectImpl(DataFactory* dataFactory, const Type& t);

    // This one only needs the values, and the type/prop info. The rest
    // is not copied and would be unsafe to do so. This is used to
    // store the cloned info in a change summary.

    DataObjectImpl(DataObjectImplPtr indo);

    virtual ~DataObjectImpl();

    /////////////////////////////////////////////////////////////////////////
    //    Introspection
    /////////////////////////////////////////////////////////////////////////

    /**  getPropertyIndex gets the unique index of a property
     *
     * A property of a data object has a unique index associated with it. 
     * This method gets a property index for this object from the property, 
     * or throw SDOPropertyNotFoundException if the property is not part 
     * of this data object.
     */

    virtual unsigned int getPropertyIndex(const Property& p);
    
    /**
     * These are just like getType().getProperty(), but may return
     * values other than the property list for open types.
     */

    virtual const Property& getProperty(unsigned int index);

    virtual const Property& getProperty(const char* prop);
    virtual const Property& getProperty(const SDOString& prop);

    virtual PropertyImpl* getPropertyImpl(const SDOString& prop);
    
    virtual PropertyImpl* getPropertyImpl(unsigned int index);

   /**  getInstanceProperties gets the props of the current object.
     *
     * Returns a read-only List of the Properties currently used in this DataObject.
     * This list will contain all of the properties in getType().getProperties()
     * and any properties where isSet(property) is true.
     * For example, properties resulting from the use of
     * open or mixed XML content are present if allowed by the Type.
     * The list does not contain duplicates. 
     * The order of the properties in the list begins with getType().getProperties()
     * and the order of the remaining properties is determined by the implementation.
     * The same list will be returned unless the DataObject is updated so that 
     * the contents of the list change
     * Returns the list of Properties currently used in this DataObject.
     */
    
    virtual PropertyList getInstanceProperties();

     /**  getContainer get the containing object
     *
     * Returns the containing data object
     * or 0 if there is no container.
     */

    virtual DataObjectPtr getContainer();

    /**  getContainmentProperty returns the property containing this object
     *
     *  Return the Property of the data object containing this data object
     *  or throw an SDOPropertyNotFoundException if there is no container.
     */

    virtual const Property& getContainmentProperty();
    
    /**  getType  returns the data object's type.
     *
     * getType returns the data object's type.
     * The type defines the properties available for reflective access.
     */
    
    virtual const Type& getType();
    
    virtual const Type::Types getTypeEnum();



    ///////////////////////////////////////////////////////////////////////////
    // get/set
    ///////////////////////////////////////////////////////////////////////////
    
    
    /**  getDataObject returns a data object by path, index or property
     *
     * Returns the value of a property of either this object or an object 
     * reachable from it, as identified by the specified path.
     */

    virtual DataObjectPtr getDataObject(const SDOString& path);
    virtual DataObjectPtr getDataObject(const char* path); 
    virtual DataObjectPtr getDataObject(unsigned int propertyIndex); 
    virtual DataObjectPtr getDataObject(const Property& property); 

    /**  setDataObject sets a value by path, index or property
     *
     * Sets a property of either this object or an object reachable from it,
     * as identified by the specified path,
     * to the specified value.
     */
    
    virtual void setDataObject(const char* path, DataObjectPtr value); 
    virtual void setDataObject(const char* path, DataObjectPtr value, bool updateSequence); 
    virtual void setDataObject(const SDOString& path, DataObjectPtr value); 
    virtual void setDataObject(const SDOString& path, DataObjectPtr value, bool updateSequence); 
    virtual void setDataObject(unsigned int propertyIndex, DataObjectPtr value); 
    virtual void setDataObject(unsigned int propertyIndex, DataObjectPtr value, bool updateSequence); 
    virtual void setDataObject(const Property& property, DataObjectPtr value); 
    virtual void setDataObject(const Property& property, DataObjectPtr value, bool updateSequence);

    /**  getBoolean returns a boolean by path, index or property
     *
     * Returns the value of a property of either this object or an object 
     * reachable from it, as identified by the specified path.
     */

    virtual bool getBoolean(const char* path);
    virtual bool getBoolean(const SDOString& path);
    virtual bool getBoolean(unsigned int propindex);
    virtual bool getBoolean(const Property& p);

    virtual void setBoolean(const char* path, bool b);
    virtual void setBoolean(const SDOString& path, bool b);
    virtual void setBoolean(unsigned int propindex, bool b);
    virtual void setBoolean(const Property& p, bool b);

    virtual char getByte(const char* path);
    virtual char getByte(const SDOString& path);
    virtual char getByte(unsigned int propindex);
    virtual char getByte(const Property& p);
    
    virtual void setByte(const char* path, char c);
    virtual void setByte(const SDOString& path, char c);
    virtual void setByte(unsigned int propindex, char c);
    virtual void setByte(const Property& p, char c);

    virtual wchar_t getCharacter(const char* path);
    virtual wchar_t getCharacter(const SDOString& path);
    virtual wchar_t getCharacter(unsigned int propindex);
    virtual wchar_t getCharacter(const Property& p);

    virtual void setCharacter(const char* path, wchar_t c);
    virtual void setCharacter(const SDOString& path, wchar_t c);
    virtual void setCharacter(unsigned int propindex, wchar_t c);
    virtual void setCharacter(const Property& p, wchar_t c);

    virtual unsigned int getLength(const SDOString& path) ;
    virtual unsigned int getLength(const char* path) ;
    virtual unsigned int getLength(unsigned int propindex) ;
    virtual unsigned int getLength(const Property& p) ;
    virtual unsigned int getLength() ;

    virtual unsigned int getBytes(const char* path, char* buf, unsigned int max) ;
    virtual unsigned int getBytes(const SDOString& path, char* buf, unsigned int max) ;
    virtual unsigned int getBytes(unsigned int propindex, char* buf, unsigned int max) ;
    virtual unsigned int getBytes(const Property& p, char* buf, unsigned int max) ;

    virtual void setBytes(const char* path, const char* c, unsigned int len) ;
    virtual void setBytes(const SDOString& path, const char* c, unsigned int len) ;
    virtual void setBytes(unsigned int propindex, const char* c,unsigned int len) ;
    virtual void setBytes(const Property& p, const char* c,unsigned int len) ;

    virtual unsigned int getString(const SDOString& path, wchar_t* buf, unsigned int max);
    virtual unsigned int getString(const char* path, wchar_t* buf, unsigned int max) ;
    virtual unsigned int getString(unsigned int propindex,wchar_t* buf, unsigned int max) ;
    virtual unsigned int getString(const Property& p,wchar_t* buf, unsigned int max) ;

    virtual void setString(const SDOString& path, const wchar_t* c,unsigned int len);
    virtual void setString(const char* path, const wchar_t* c,unsigned int len) ;
    virtual void setString(unsigned int propindex, const wchar_t* c,unsigned int len) ;
    virtual void setString(const Property& p, const wchar_t* c,unsigned int len) ;

    virtual const SDODate getDate(const SDOString& path);
    virtual const SDODate getDate(const char* path);
    virtual const SDODate getDate(unsigned int propindex);
    virtual const SDODate getDate(const Property& p);

    virtual void setDate(const SDOString& path, const SDODate d);
    virtual void setDate(const char* path, const SDODate d);
    virtual void setDate(unsigned int propindex, const SDODate d);
    virtual void setDate(const Property& p, const SDODate d);

    virtual long double getDouble(const SDOString& path);
    virtual long double getDouble(const char* path);
    virtual long double getDouble(unsigned int propindex);
    virtual long double getDouble(const Property& p);
    
    virtual void setDouble(const SDOString& path, long double d);
    virtual void setDouble(const char* path, long double d);
    virtual void setDouble(unsigned int propindex, long double d);
    virtual void setDouble(const Property& p, long double d);

    virtual float getFloat(const SDOString& path);
    virtual float getFloat(const char* path);
    virtual float getFloat(unsigned int propindex);
    virtual float getFloat(const Property& p);

    virtual void setFloat(const SDOString& path, float f);
    virtual void setFloat(const char* path, float f);
    virtual void setFloat(unsigned int propindex, float f);
    virtual void setFloat(const Property& p, float f);

    virtual long getInteger(const SDOString& path);
    virtual long getInteger(const char* path);
    virtual long getInteger(unsigned int propindex);
    virtual long getInteger(const Property& p);
    
    virtual void setInteger(const SDOString& path, long i);
    virtual void setInteger(const char* path, long i);
    virtual void setInteger(unsigned int propindex, long i);
    virtual void setInteger(const Property& p, long i);

    virtual /*long long*/ int64_t getLong(const SDOString& path);
    virtual /*long long*/ int64_t getLong(const char* path);
    virtual /*long long*/ int64_t getLong(unsigned int propindex);
    virtual /*long long*/ int64_t getLong(const Property& p);

    virtual void setLong(const SDOString& path, /*long long*/ int64_t l);
    virtual void setLong(const char* path, /*long long*/ int64_t l);
    virtual void setLong(unsigned int propindex, /*long long*/ int64_t l);
    virtual void setLong(const Property& p, /*long long*/ int64_t l);

    virtual short getShort(const SDOString& path);
    virtual short getShort(const char* path);
    virtual short getShort(unsigned int propindex);
    virtual short getShort(const Property& p);

    virtual void setShort(const SDOString& path, short s);
    virtual void setShort(const char* path, short s);
    virtual void setShort(unsigned int propindex, short s);
    virtual void setShort(const Property& p, short s);

    virtual const char* getCString(const char* path);
    virtual const char* getCString(const SDOString& path);
    virtual const char* getCString(unsigned int propertyIndex);
    virtual const char* getCString(const Property& prop);
    
    virtual void setCString(const char* path, const char* value);
    virtual void setCString(unsigned int propertyIndex, const char* value);
    virtual void setCString (const Property& prop, const char* value);

    virtual void setCString(const SDOString& path, const SDOString& value);
    virtual void setCString(unsigned int propertyIndex, const SDOString& value);
    virtual void setCString (const Property& prop, const SDOString& value);
    
    /**  setNull sets a data object value to null.
     *
     * A DataObjectType or DataType value may be set or unset. If it is set, then
     * it may have a value, or it may be set to null. A distinction is drawn between
     * being unset, having the default value, being set and being null.
     * When the value of an integer (for example) is returned as zero, it could have
     * been set to zero, or it could be null. Use isNull() to verify.
        */

    virtual void setNull(const SDOString& path);
    virtual void setNull(const char* path);
    virtual void setNull(unsigned int propertyIndex);
    virtual void setNull(const Property& prop);
    
    virtual bool isNull(const SDOString& path);
    virtual bool isNull(const char* path);
    virtual bool isNull(unsigned int propertyIndex);
    virtual bool isNull(const Property& prop);
    
    virtual bool isSet(const char* path);
    virtual bool isSet(const SDOString& path);
    virtual bool isSet(unsigned int propertyIndex);
    virtual bool isSet(const Property& property);

    virtual bool isValid(const SDOString& path);
    virtual bool isValid(const char* path);
    virtual bool isValid(unsigned int propertyIndex);
    virtual bool isValid(const Property& property);

    virtual void unset(const char* path);
    virtual void unset(const SDOString& path);
    virtual void unset(unsigned int propertyIndex);
    virtual void unset(const Property& property);


    ///////////////////////////////////////////////////////////////////////////
    // Sequences
    ///////////////////////////////////////////////////////////////////////////

    /**  getSequence returns the sequence for a data object
     *
     * Returns the value of a Sequence property identified by 
     * the specified path. See Sequence.
     */

    virtual SequenceImpl* getSequenceImpl();
    virtual SequencePtr getSequence();
    virtual SequencePtr getSequence(const char* path);
    virtual SequencePtr getSequence(const SDOString& path);
    virtual SequencePtr getSequence(unsigned int propertyIndex);
    virtual SequencePtr getSequence(const Property& property);


    ///////////////////////////////////////////////////////////////////////////    
    // Creation of dataobjects 
    ///////////////////////////////////////////////////////////////////////////

    /**  createDataObject creates a data object value
     *
     * Returns a new data object contained by this object using the 
     * specified property,which must be a containment property.
     * The type of the created object is the declared type
     * of the specified property.
     * If the property is many valued, this method adds an element to the
     * list, otherwise it sets the value, removing any old value.
     */
    
    virtual DataObjectPtr createDataObject(const char* propertyName);
    virtual DataObjectPtr createDataObject(const SDOString& propertyName);
    virtual DataObjectPtr createDataObject(unsigned int propertyIndex);
    virtual DataObjectPtr createDataObject(const Property& property);


    /**
     * See if the property currently exists
     */

    virtual bool hasProperty(const char* name);
    virtual bool hasProperty(const SDOString& name);


    virtual void detach();

    virtual void clear();


    ///////////////////////////////////////////////////////////////////////////
    // Lists
    ///////////////////////////////////////////////////////////////////////////

   /**  getList gets the value of a many-valued property
     *
     * Many valued properties are returned as lists of DataObjects.
     * These lists may contain primitives or data objects, but they behave
     * like data objects.
     * Getting a many valued integer consists of getting the list, then
     * using the DataObjectList API to getInteger() for each list element.
     */

    virtual DataObjectList& getList(const char* path);
    virtual DataObjectList& getList(const SDOString& path);
    virtual DataObjectList& getList(unsigned int propIndex);
    virtual DataObjectList& getList(const Property& p);
    virtual DataObjectList& getList();
    virtual DataObjectListImpl* getListImpl();

    void setList( DataObjectList* theList);

    ///////////////////////////////////////////////////////////////////////////
    // Change Summary
    ///////////////////////////////////////////////////////////////////////////
    
    /**  getChangeSummary get the applicable change summary
     *
     * This method gets the applicable change summary for a data object.
     * The summary is not necessarily attached to the data object, it may be
     * the summary for a parent data object. No object with a summary attached
     * may be a child of another object with a summary attached. 
     * See the ChangeSummary API for details of using the change sumamry.
     */

    virtual SDO_API ChangeSummaryPtr getChangeSummary(const char* path);
    virtual SDO_API ChangeSummaryPtr getChangeSummary(const SDOString& path);
    virtual SDO_API ChangeSummaryPtr getChangeSummary(unsigned int propIndex);
    virtual SDO_API ChangeSummaryPtr getChangeSummary(const Property& prop);
      virtual SDO_API ChangeSummaryPtr getChangeSummary();


    virtual bool getBoolean();
    virtual void setBoolean(bool b);
    virtual char getByte();
    virtual void setByte(char c);
    virtual wchar_t getCharacter();
    virtual void setCharacter(wchar_t c);
    virtual unsigned int getString(wchar_t* buf, unsigned int max);
    virtual unsigned int getBytes(char* buf, unsigned int max);
    virtual void setString(const wchar_t* buf, unsigned int len);
    virtual void setBytes(const char* c, unsigned int len);
    virtual short getShort();
    virtual void setShort(short s);
    virtual long getInteger();
    virtual void setInteger(long s);
    virtual /* long long*/ int64_t getLong();
    virtual void setLong(/* long long */ int64_t i);
    virtual float getFloat();
    virtual void setFloat(float b);
    virtual long double getDouble();
    virtual void setDouble(long double d);
    virtual const SDODate getDate();
    virtual void setDate(const SDODate d);
    virtual const char*  getCString();
    virtual void setCString(const char* s);
    virtual void setCString(const SDOString& s);
    virtual void setSDOValue(const SDOValue& s);
    virtual DataObjectImpl* getDataObject();
    virtual void setDataObject(DataObject* d);

    // null support
    virtual bool isNull();
    virtual void setNull();
    virtual void unsetNull();

    // change logging is used by the dataobjectlistimpl
    virtual void logChange(const Property& prop);
    virtual void logChange(unsigned int propIndex);
    virtual void logDeletion();
    virtual void logCreation(DataObjectImpl* dol,
        DataObjectImpl* cont, const Property& prop);

    // reference support
    virtual void setReference(DataObject* dob, const Property& prop);
    virtual void unsetReference(DataObject* dob, const Property& prop);
    virtual void clearReferences();
    
    // user data support
    virtual void setUserData(const char* path,void* value);
    virtual void setUserData(const SDOString& path, void* value);
    virtual void setUserData(unsigned int propertyIndex, void* value);
    virtual void setUserData(const Property& property, void* value);
    virtual void setUserData(void* value);
    virtual void* getUserData(const char* path);
    virtual void* getUserData(const SDOString& path);
    virtual void* getUserData(unsigned int propertyIndex);
    virtual void* getUserData(const Property& property);
    virtual void* getUserData();

    virtual void setContainer(DataObjectImpl* d);
    DataObjectImpl* getContainerImpl();

    // builds a temporary XPath for this object.
    const char* objectToXPath();

    // The data factory can be used to create new data objects within
    // the Type system of this data object
    // 
      
    SDO_API DataFactory* getDataFactory();

    // open type support
    virtual void   setInstancePropertyType(unsigned int index,
                                            const Type* t);

    /** 
     * defineProperty is used by open type support.
     * This method and its siblings define a new property on an
     * open type when a setting is requested.
     */
    virtual const PropertyImpl* defineProperty(const SDOString& propname, 
                 const Type& t);

    virtual const PropertyImpl* defineSDOValue(const SDOString& propname,
                                               const SDOValue& sval);
    virtual const PropertyImpl* defineBoolean(const SDOString& propname);
    virtual const PropertyImpl* defineByte(const SDOString& propname);
    virtual const PropertyImpl* defineCharacter(const SDOString& propname);
    virtual const PropertyImpl* defineString(const SDOString& propname);
    virtual const PropertyImpl* defineBytes(const SDOString& propname);
    virtual const PropertyImpl* defineShort(const SDOString& propname);
    virtual const PropertyImpl* defineInteger(const SDOString& propname);
    virtual const PropertyImpl* defineLong(const SDOString& propname);
    virtual const PropertyImpl* defineFloat(const SDOString& propname);
    virtual const PropertyImpl* defineDouble(const SDOString& propname);
    virtual const PropertyImpl* defineDate(const SDOString& propname);
    virtual const PropertyImpl* defineCString(const SDOString& propname);
    virtual const PropertyImpl* defineDataObject(const SDOString& propname,
        const Type&t );
    virtual const PropertyImpl* defineDataObject(const char* propname,
        const char* typeURI, const char* typeName );
    virtual const PropertyImpl* defineList(const char* propname);
    virtual void  undefineProperty(unsigned int index);
    virtual const TypeImpl& getTypeImpl();
    virtual void setDataFactory(DataFactory *df);

    virtual std::ostream& printSelf(std::ostream &os);

    virtual const SDOValue& getSDOValue(PropertyImpl** propertyForDefault);
    virtual const SDOValue& getSDOValue(const unsigned int propertyIndex,
                                        PropertyImpl** propertyForDefault);
    virtual const SDOValue& getSDOValue(const Property& property,
                                        PropertyImpl** propertyForDefault);
    virtual const SDOValue& getSDOValue(const SDOString& path,
                                        PropertyImpl** propertyForDefault);
    virtual void setSDOValue(const SDOString& path, const SDOValue& sval, const SDOString& dataType);
    virtual void setSDOValue(unsigned int propindex, const SDOValue& sval, const SDOString& dataType);
    virtual void setSDOValue(unsigned int propindex, const SDOValue& sval, const SDOString& dataType, bool updateSequence);
    virtual void setSDOValue(const Property& p, const SDOValue& sval, const SDOString& dataType);
    virtual void setSDOValue(const Property& p, const SDOValue& sval, const SDOString& dataType, bool updateSequence);



private:
	/**
	 * This method is used internally to find the index of a 
	 * property. If differs from the public getPropertyIndex method
	 * in that if the type of the containing object is open a new
	 * index is created. In the public version and error is thrown
	 */
	virtual unsigned int getPropertyIndexInternal(const Property& p);

    virtual void validateIndex(unsigned int index);
    virtual void checkFactory(DataObjectPtr dob, unsigned int propertyIndex);
    virtual void checkType(    const Property& prop,
                    const Type& objectType);
     
    virtual bool remove(DataObjectImpl* indol);
    virtual bool isSet(const Property& prop, unsigned int propertyIndex);

   
    virtual DataObjectImpl* getDataObjectImpl(const SDOString& path); 
    virtual DataObjectImpl* getDataObjectImpl(unsigned int propertyIndex); 
    virtual DataObjectImpl* getDataObjectImpl(const Property& property); 

    virtual DataObjectPtr
        createDataObject(const Property& property, 
        const char* namespaceURI,
        const char* typeName);

    DataObjectImpl* findDataObject(const SDOString& token, long* index);
     const Property*   findInProperties(DataObject* ob);

     SDOString findPropertyContainer(const SDOString& path, DataObjectImpl** din);

     char* stripPath(const char* path);
     void stripPath(const SDOString& path, SDOString& result);


    // Does not keep a reference counted pointer to the container.
    DataObjectImpl* container;

    PropertyValueMap PropertyValues;
    
    TypeImpl* ObjectType;

    DataObjectListImpl* listValue;
    
    // Holds the value as an SDOValue object, if the value is a primitive data type.
    SDOValue sdoValue;

    // If the value is a data object, it is recorded here.
    DataObjectImpl* doValue;

    // holds the Xpath to this object if requested.
    std::string asXPathBuffer;

    // The data object holds a counted reference to the data factory.
    DataFactoryPtr factory;

 
    // Support for open types
    unsigned int openBase;
    std::list<PropertyImpl> openProperties;

    static const char* templateString;

    // Data may be set to null in any data object
    bool isnull;

    // user supplied 32 bit value.
    void* userdata;

    //
    // The sequence, if this is a sequenced type - not
    // reference counted by the data object
    //
    SequenceImpl* sequence;

    //
    // The change summary if this is a summarised type
    // not reference counted by the data object - only by
    // clients
    //

    ChangeSummaryImpl* getChangeSummaryImpl();
    ChangeSummaryImpl* getSummary();
    ChangeSummaryImpl* localCS;


    // reference type support

    class Reference
    {
    public:
        DataObject* getDataObject()
        {
            return referer;
        }
        const Property& getProperty()
        {
            return refprop;
        }
        Reference(DataObject* d, const Property& p) : refprop(p), referer(d)
        {
        }
    private:
        DataObject* referer;
        const Property& refprop;
    };

    typedef std::vector<Reference*> REFERENCE_LIST;

    REFERENCE_LIST refs;


  
};
};
};
 
#endif //_DATAOBJECTIMPL_H_