OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimDataObject.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: LGPL
4 //
5 // See LICENSE.txt file in the top level directory for more details.
6 //
7 // Author: Garrett Potts
8 //
9 //*************************************************************************
10 // $Id: ossimDataObject.cpp 19931 2011-08-10 11:53:25Z gpotts $
12 #include <ossim/base/ossimSource.h>
14 
15 RTTI_DEF1(ossimDataObject, "ossimDataObject", ossimObject)
16 
19  :
20  theOwner(source),
21  theDataObjectStatus(status)
22 {
23 }
24 
26  : ossimObject(),
27  theOwner(0),
28  theDataObjectStatus(rhs.theDataObjectStatus)
29 {
30 }
31 
33 {
34 }
35 
37 {
38  theOwner = aSource;
39 }
40 
42 {
43  return theOwner;
44 }
45 
47 {
48  return theOwner;
49 }
50 
52 {
54 }
55 
57 {
58  return theDataObjectStatus;
59 }
60 
62 {
63  ossimString s;
64 
65  switch (theDataObjectStatus)
66  {
67  case OSSIM_NULL:
68  s = "OSSIM_NULL";
69  break;
70 
71  case OSSIM_EMPTY:
72  s = "OSSIM_EMPTY";
73  break;
74 
75  case OSSIM_PARTIAL:
76  s = "OSSIM_PARTIAL";
77  break;
78 
79  case OSSIM_FULL:
80  s = "OSSIM_FULL";
81  break;
82 
84  default:
85  s = "OSSIM_STATUS_UNKNOWN";
86  break;
87  }
88 
89  return s;
90 }
91 
93 {
94  return sizeof(theOwner);
95 }
96 
98 {
99  return (getDataObjectStatus()!=OSSIM_NULL);
100 }
101 
103 {
104  return ( theOwner != rhs.theOwner ||
106 }
107 
109 {
110  return (theOwner == rhs.theOwner &&
112 }
113 
115 {
116  if(rhs != this)
117  {
118  theOwner = rhs->theOwner;
120  }
121 }
122 
124 {
125  assign(rhs);
126  return this;
127 }
128 
130 {
131  if (this != &rhs)
132  {
133  theOwner = rhs.theOwner;
135  }
136  return *this;
137 }
138 
140 {
141  out << "ossimDataObject::print:";
142 
143  if (theOwner)
144  {
145  out << "\ntheOwner->getClassName(): "
146  << theOwner->getClassName()<<endl;
147  }
148  else
149  {
150  out << "\ntheOwner is null"
151  <<endl;
152  }
153  out << "theDataObjectStatus: " << getDataObjectStatusString()
154  << endl;
155 
156  return out;
157 }
158 
159 bool ossimDataObject::saveState(ossimKeywordlist& kwl, const char* prefix)const
160 {
161  kwl.add(prefix, "data_object_status", getDataObjectStatusString(), true);
162  return ossimObject::saveState(kwl, prefix);
163 }
164 
165 bool ossimDataObject::loadState(const ossimKeywordlist& kwl, const char* prefix)
166 {
167  ossimString data_object_status = kwl.find(prefix, "data_object_status");
168  if(!data_object_status.empty())
169  {
170  data_object_status = data_object_status.upcase();
171  if(data_object_status == "OSSIM_FULL")
172  {
174  }
175  else if(data_object_status == "OSSIM_PARTIAL")
176  {
178  }
179  else if(data_object_status == "OSSIM_EMPTY")
180  {
182  }
183  else if(data_object_status == "OSSIM_STATUS_UNKNOWN")
184  {
186  }
187  }
188 
189  return ossimObject::loadState(kwl, prefix);
190 }
static ossimString upcase(const ossimString &aString)
Definition: ossimString.cpp:34
virtual void setOwner(ossimSource *aSource)
Sets the owner of this Data object.
Represents serializable keyword/value map.
const char * find(const char *key) const
virtual const ossimDataObject * operator=(const ossimDataObject *rhs)
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Definition: ossimObject.cpp:95
virtual ossimString getDataObjectStatusString() const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual ossimString getClassName() const
Definition: ossimObject.cpp:64
ossimDataObject(ossimSource *source=0, ossimDataObjectStatus status=OSSIM_STATUS_UNKNOWN)
virtual bool isInitialize() const
This is to be overriden in the derived classes so they can check If their data is null...
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual std::ostream & print(std::ostream &out) const
Generic print method.
unsigned int ossim_uint32
virtual void assign(const ossimDataObject *rhs)
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
ossimSource * theOwner
return status
virtual ossim_uint32 getObjectSizeInBytes() const
bool empty() const
Definition: ossimString.h:411
virtual void setDataObjectStatus(ossimDataObjectStatus status) const
Full list found in ossimConstants.h.
virtual ossimSource * getOwner()
virtual ~ossimDataObject()
virtual bool operator!=(const ossimDataObject &rhs) const
#define RTTI_DEF1(cls, name, b1)
Definition: ossimRtti.h:485
virtual bool operator==(const ossimDataObject &rhs) const
ossimDataObjectStatus
Definitions for data object status.
ossimDataObjectStatus theDataObjectStatus
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23