NCBI C++ ToolKit
PluginObject.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: PluginObject.cpp 30280 2014-04-23 20:28:26Z katargir $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author: .......
27  *
28  * File Description:
29  * .......
30  *
31  * Remark:
32  * This code was originally generated by application DATATOOL
33  * using specifications from the data definition file
34  * 'plugin.asn'.
35  */
36 
37 // standard includes
38 
39 // generated includes
40 #include <ncbi_pch.hpp>
43 
44 // generated classes
45 
47 
48 BEGIN_objects_SCOPE // namespace ncbi::objects::
49 
50 // destructor
52 {
53 }
54 
55 
56 //
57 //
59 {
60  m_Project.Reset(project);
61  m_Object.Reset(project);
62 
64  SetSubtype(CGBProjectHandle::GetTypeInfo()->GetName());
65 }
66 
67 
68 void CPluginObject::SetObject(const CObject& obj, const CGBProjectHandle* project, const CDataHandle * dh)
69 {
70  m_Project.Reset(project);
71  m_Object.Reset(&obj);
72 
74 
75  // subtype determination
76  SetSubtype("Object");
77  {{
78  const CSerialObject* ptr =
79  dynamic_cast<const CSerialObject*>(m_Object.GetPointer());
80  if (ptr) {
82  }
83  }}
84 }
85 
86 
88 {
89  if (info) {
90  SetObject(info->GetName());
91  } else {
92  SetObject("Object");
93  }
94 }
95 
96 
97 void CPluginObject::SetObject(const string& type)
98 {
99  m_Project.Reset();
100  m_Object.Reset();
101 
103  SetSubtype(type);
104 }
105 
106 
107 //
108 // overloaded Assign() because we have some derived information to copy as well
109 //
111 {
112  const CPluginObject& o = dynamic_cast<const CPluginObject&> (obj);
113 
114  // copy the address - this is the base class info
115  SetObjaddr(o.GetObjaddr());
116  SetSubtype(o.GetSubtype());
117 
118  // copy our derived info as well
119  m_Object = o.m_Object;
120  m_Project = o.m_Project;
121 }
122 
123 
125 {
126  const CPluginObject& o = dynamic_cast<const CPluginObject&> (obj);
127 
128  return (GetObjaddr() == o.GetObjaddr() &&
129  GetSubtype() == o.GetSubtype() &&
130  GetProject() == o.GetProject() &&
131  GetObject() == o.GetObject());
132 }
133 
134 
135 
136 // Reset()
137 // this is overloaded from CPluginObject_Base and allows us to reset our derived
138 // type information
140 {
141  // call the base class
142  Tparent::Reset();
143 
144  // reset our specific information
145  m_Object.Reset();
146  m_Project.Reset();
147 }
148 
149 
150 //
151 // PostRead()
152 // this function is responsible for parsing any state information from our
153 // address string
154 //
156 {
158  (static_cast<const CObject*>(NStr::StringToPtr(GetObjaddr())));
159 
160  /**
161  //
162  // store our derived object type information
163  //
164  SetSubtype("Object");
165 
166  // generic handling of CSerialObject-derived classes
167  {{
168  const CSerialObject* obj =
169  dynamic_cast<const CSerialObject*>(m_Object.GetPointer());
170  if (obj) {
171  SetSubtype(obj->GetThisTypeInfo()->GetName());
172  }
173  }}
174 
175  // generic handling of CGBProjectHandles
176  {{
177  const CGBProjectHandle* obj =
178  dynamic_cast<const CGBProjectHandle*>(m_Object.GetPointer());
179  if (obj) {
180  SetSubtype("Project");
181  }
182  }}
183  **/
184 }
185 
186 
187 END_objects_SCOPE // namespace ncbi::objects::
188 
190 
191 /* Original file checksum: lines: 64, chars: 1886, CRC32: f857b507 */
namespace ncbi::objects::
static const void * StringToPtr(const CTempStringEx &str)
Convert string to pointer.
Definition: ncbistr.cpp:2632
static void PtrToString(string &out_str, const void *ptr)
Convert pointer to string.
Definition: ncbistr.cpp:2623
~CPluginObject(void)
destructor
User-defined methods of the data storage class.
virtual bool UserOp_Equals(const CSerialUserOp &object) const
Will be called after comparing the datatool-generated members.
#define NULL
Definition: ncbistd.hpp:225
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:1300
const TSubtype & GetSubtype(void) const
Get the Subtype member data.
const CGBProjectHandle * GetProject(void) const
access the project for this object
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:101
virtual void UserOp_Assign(const CSerialUserOp &source)
From CSerialUserOp.
void Reset(void)
overloaded Reset() - allows us to clear our derived types
Base class for user-defined serializable classes to allow for objects assignment and comparison...
Definition: serialbase.hpp:277
CConstRef< CGBProjectHandle > m_Project
we must hold CConstRef<>s of our object to make sure they don't fall out of scope ...
const TObjaddr & GetObjaddr(void) const
Get the Objaddr member data.
TSubtype & SetSubtype(void)
Assign a value to Subtype data member.
CConstRef< CObject > m_Object
virtual void Reset(void)
Reset the whole object.
void SetObject(const string &type)
Base class for all serializable objects.
Definition: serialbase.hpp:148
CObject –.
Definition: ncbiobj.hpp:180
CTypeInfo class contains all information about C++ types (both basic and classes): members and layout...
Definition: typeinfo.hpp:74
TObjaddr & SetObjaddr(void)
Assign a value to Objaddr data member.
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:1498
const CObject * GetObject(void) const
access the object for this object
virtual const CTypeInfo * GetThisTypeInfo(void) const =0
const string & GetName(void) const
Get name of this type.
Definition: typeinfo.cpp:220
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:98
void SetProject(const CGBProjectHandle *doc)
void PostRead()
PostRead() - provides ability to set derived type.
Modified on Mon Jul 06 13:57:50 2015 by modify_doxy.py rev. 426318