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

Go to the SVN repository for this file.

1 /* $Id$
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  * File Description:
27  * This code was generated by application DATATOOL
28  * using the following specifications:
29  * 'mmdb3.asn'.
30  *
31  * ATTENTION:
32  * Don't edit or commit this file into CVS as this file will
33  * be overridden (by DATATOOL) without warning!
34  * ===========================================================================
35  */
36 
37 // standard includes
38 #include <ncbi_pch.hpp>
39 #include <serial/serialimpl.hpp>
40 
41 // generated includes
45 #include <objects/mmdb3/Camera.hpp>
55 
56 BEGIN_objects_SCOPE // namespace ncbi::objects::
57 
58 
59 // generated classes
60 
62 {
63  SET_ENUM_INTERNAL_NAME("Biostruc-feature", "type");
64  SET_ENUM_MODULE("MMDB-Features");
65  ADD_ENUM_VALUE("helix", eType_helix);
66  ADD_ENUM_VALUE("strand", eType_strand);
67  ADD_ENUM_VALUE("sheet", eType_sheet);
68  ADD_ENUM_VALUE("turn", eType_turn);
69  ADD_ENUM_VALUE("site", eType_site);
70  ADD_ENUM_VALUE("footnote", eType_footnote);
71  ADD_ENUM_VALUE("comment", eType_comment);
72  ADD_ENUM_VALUE("interaction", eType_interaction);
73  ADD_ENUM_VALUE("subgraph", eType_subgraph);
74  ADD_ENUM_VALUE("region", eType_region);
75  ADD_ENUM_VALUE("core", eType_core);
76  ADD_ENUM_VALUE("supercore", eType_supercore);
77  ADD_ENUM_VALUE("color", eType_color);
78  ADD_ENUM_VALUE("render", eType_render);
79  ADD_ENUM_VALUE("label", eType_label);
80  ADD_ENUM_VALUE("transform", eType_transform);
81  ADD_ENUM_VALUE("camera", eType_camera);
82  ADD_ENUM_VALUE("script", eType_script);
83  ADD_ENUM_VALUE("alignment", eType_alignment);
84  ADD_ENUM_VALUE("similarity", eType_similarity);
85  ADD_ENUM_VALUE("multalign", eType_multalign);
86  ADD_ENUM_VALUE("indirect", eType_indirect);
87  ADD_ENUM_VALUE("cn3dstate", eType_cn3dstate);
88  ADD_ENUM_VALUE("other", eType_other);
89 }
91 
93 {
94  if ( m_choice != e_not_set )
96 }
97 
99 {
100  switch ( m_choice ) {
101  case e_Color:
102  case e_Transform:
103  case e_Camera:
104  case e_Script:
105  case e_User:
106  m_object->RemoveReference();
107  break;
108  default:
109  break;
110  }
111  m_choice = e_not_set;
112 }
113 
114 void CBiostruc_feature_Base::C_Property::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
115 {
116  switch ( index ) {
117  case e_Color:
118  (m_object = new(pool) ncbi::objects::CColor_prop())->AddReference();
119  break;
120  case e_Render:
121  m_Render = (int)(0);
122  break;
123  case e_Transform:
124  (m_object = new(pool) ncbi::objects::CTransform())->AddReference();
125  break;
126  case e_Camera:
127  (m_object = new(pool) ncbi::objects::CCamera())->AddReference();
128  break;
129  case e_Script:
130  (m_object = new(pool) ncbi::objects::CBiostruc_script())->AddReference();
131  break;
132  case e_User:
133  (m_object = new(pool) ncbi::objects::CUser_object())->AddReference();
134  break;
135  default:
136  break;
137  }
138  m_choice = index;
139 }
140 
142  "not set",
143  "color",
144  "render",
145  "transform",
146  "camera",
147  "script",
148  "user"
149 };
150 
152 {
153  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
154 }
155 
157 {
158  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
159 }
160 
162 {
163  CheckSelected(e_Color);
164  return *static_cast<const TColor*>(m_object);
165 }
166 
168 {
169  Select(e_Color, NCBI_NS_NCBI::eDoNotResetVariant);
170  return *static_cast<TColor*>(m_object);
171 }
172 
174 {
175  TColor* ptr = &value;
176  if ( m_choice != e_Color || m_object != ptr ) {
177  ResetSelection();
178  (m_object = ptr)->AddReference();
179  m_choice = e_Color;
180  }
181 }
182 
184 {
185  CheckSelected(e_Transform);
186  return *static_cast<const TTransform*>(m_object);
187 }
188 
190 {
191  Select(e_Transform, NCBI_NS_NCBI::eDoNotResetVariant);
192  return *static_cast<TTransform*>(m_object);
193 }
194 
196 {
197  TTransform* ptr = &value;
198  if ( m_choice != e_Transform || m_object != ptr ) {
199  ResetSelection();
200  (m_object = ptr)->AddReference();
201  m_choice = e_Transform;
202  }
203 }
204 
206 {
207  CheckSelected(e_Camera);
208  return *static_cast<const TCamera*>(m_object);
209 }
210 
212 {
213  Select(e_Camera, NCBI_NS_NCBI::eDoNotResetVariant);
214  return *static_cast<TCamera*>(m_object);
215 }
216 
218 {
219  TCamera* ptr = &value;
220  if ( m_choice != e_Camera || m_object != ptr ) {
221  ResetSelection();
222  (m_object = ptr)->AddReference();
223  m_choice = e_Camera;
224  }
225 }
226 
228 {
229  CheckSelected(e_Script);
230  return *static_cast<const TScript*>(m_object);
231 }
232 
234 {
235  Select(e_Script, NCBI_NS_NCBI::eDoNotResetVariant);
236  return *static_cast<TScript*>(m_object);
237 }
238 
240 {
241  TScript* ptr = &value;
242  if ( m_choice != e_Script || m_object != ptr ) {
243  ResetSelection();
244  (m_object = ptr)->AddReference();
245  m_choice = e_Script;
246  }
247 }
248 
250 {
251  CheckSelected(e_User);
252  return *static_cast<const TUser*>(m_object);
253 }
254 
256 {
257  Select(e_User, NCBI_NS_NCBI::eDoNotResetVariant);
258  return *static_cast<TUser*>(m_object);
259 }
260 
262 {
263  TUser* ptr = &value;
264  if ( m_choice != e_User || m_object != ptr ) {
265  ResetSelection();
266  (m_object = ptr)->AddReference();
267  m_choice = e_User;
268  }
269 }
270 
271 // helper methods
272 
273 // type info
275 {
276  SET_INTERNAL_NAME("Biostruc-feature", "property");
277  SET_CHOICE_MODULE("MMDB-Features");
278  ADD_NAMED_REF_CHOICE_VARIANT("color", m_object, CColor_prop);
279  ADD_NAMED_ENUM_CHOICE_VARIANT("render", m_Render, ERender_prop);
280  ADD_NAMED_REF_CHOICE_VARIANT("transform", m_object, CTransform);
281  ADD_NAMED_REF_CHOICE_VARIANT("camera", m_object, CCamera);
282  ADD_NAMED_REF_CHOICE_VARIANT("script", m_object, CBiostruc_script);
283  ADD_NAMED_REF_CHOICE_VARIANT("user", m_object, CUser_object);
284  info->CodeVersion(22301);
285  info->DataSpec(ncbi::EDataSpec::eASN);
286 }
288 
289 // constructor
291  : m_choice(e_not_set)
292 {
293 }
294 
295 // destructor
297 {
298  Reset();
299 }
300 
301 
303 {
304  if ( m_choice != e_not_set )
305  ResetSelection();
306 }
307 
309 {
310  switch ( m_choice ) {
311  case e_Subgraph:
312  case e_Region:
313  case e_Alignment:
314  case e_Interaction:
315  case e_Similarity:
316  case e_Indirect:
317  m_object->RemoveReference();
318  break;
319  default:
320  break;
321  }
322  m_choice = e_not_set;
323 }
324 
325 void CBiostruc_feature_Base::C_Location::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
326 {
327  switch ( index ) {
328  case e_Subgraph:
329  (m_object = new(pool) ncbi::objects::CChem_graph_pntrs())->AddReference();
330  break;
331  case e_Region:
332  (m_object = new(pool) ncbi::objects::CRegion_pntrs())->AddReference();
333  break;
334  case e_Alignment:
335  (m_object = new(pool) ncbi::objects::CChem_graph_alignment())->AddReference();
336  break;
337  case e_Interaction:
338  (m_object = new(pool) ncbi::objects::CChem_graph_interaction())->AddReference();
339  break;
340  case e_Similarity:
341  (m_object = new(pool) ncbi::objects::CRegion_similarity())->AddReference();
342  break;
343  case e_Indirect:
344  (m_object = new(pool) ncbi::objects::COther_feature())->AddReference();
345  break;
346  default:
347  break;
348  }
349  m_choice = index;
350 }
351 
353  "not set",
354  "subgraph",
355  "region",
356  "alignment",
357  "interaction",
358  "similarity",
359  "indirect"
360 };
361 
363 {
364  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
365 }
366 
368 {
369  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
370 }
371 
373 {
374  CheckSelected(e_Subgraph);
375  return *static_cast<const TSubgraph*>(m_object);
376 }
377 
379 {
380  Select(e_Subgraph, NCBI_NS_NCBI::eDoNotResetVariant);
381  return *static_cast<TSubgraph*>(m_object);
382 }
383 
385 {
386  TSubgraph* ptr = &value;
387  if ( m_choice != e_Subgraph || m_object != ptr ) {
388  ResetSelection();
389  (m_object = ptr)->AddReference();
390  m_choice = e_Subgraph;
391  }
392 }
393 
395 {
396  CheckSelected(e_Region);
397  return *static_cast<const TRegion*>(m_object);
398 }
399 
401 {
402  Select(e_Region, NCBI_NS_NCBI::eDoNotResetVariant);
403  return *static_cast<TRegion*>(m_object);
404 }
405 
407 {
408  TRegion* ptr = &value;
409  if ( m_choice != e_Region || m_object != ptr ) {
410  ResetSelection();
411  (m_object = ptr)->AddReference();
412  m_choice = e_Region;
413  }
414 }
415 
417 {
418  CheckSelected(e_Alignment);
419  return *static_cast<const TAlignment*>(m_object);
420 }
421 
423 {
424  Select(e_Alignment, NCBI_NS_NCBI::eDoNotResetVariant);
425  return *static_cast<TAlignment*>(m_object);
426 }
427 
429 {
430  TAlignment* ptr = &value;
431  if ( m_choice != e_Alignment || m_object != ptr ) {
432  ResetSelection();
433  (m_object = ptr)->AddReference();
434  m_choice = e_Alignment;
435  }
436 }
437 
439 {
440  CheckSelected(e_Interaction);
441  return *static_cast<const TInteraction*>(m_object);
442 }
443 
445 {
446  Select(e_Interaction, NCBI_NS_NCBI::eDoNotResetVariant);
447  return *static_cast<TInteraction*>(m_object);
448 }
449 
451 {
452  TInteraction* ptr = &value;
453  if ( m_choice != e_Interaction || m_object != ptr ) {
454  ResetSelection();
455  (m_object = ptr)->AddReference();
456  m_choice = e_Interaction;
457  }
458 }
459 
461 {
462  CheckSelected(e_Similarity);
463  return *static_cast<const TSimilarity*>(m_object);
464 }
465 
467 {
468  Select(e_Similarity, NCBI_NS_NCBI::eDoNotResetVariant);
469  return *static_cast<TSimilarity*>(m_object);
470 }
471 
473 {
474  TSimilarity* ptr = &value;
475  if ( m_choice != e_Similarity || m_object != ptr ) {
476  ResetSelection();
477  (m_object = ptr)->AddReference();
478  m_choice = e_Similarity;
479  }
480 }
481 
483 {
484  CheckSelected(e_Indirect);
485  return *static_cast<const TIndirect*>(m_object);
486 }
487 
489 {
490  Select(e_Indirect, NCBI_NS_NCBI::eDoNotResetVariant);
491  return *static_cast<TIndirect*>(m_object);
492 }
493 
495 {
496  TIndirect* ptr = &value;
497  if ( m_choice != e_Indirect || m_object != ptr ) {
498  ResetSelection();
499  (m_object = ptr)->AddReference();
500  m_choice = e_Indirect;
501  }
502 }
503 
504 // helper methods
505 
506 // type info
508 {
509  SET_INTERNAL_NAME("Biostruc-feature", "location");
510  SET_CHOICE_MODULE("MMDB-Features");
511  ADD_NAMED_REF_CHOICE_VARIANT("subgraph", m_object, CChem_graph_pntrs);
512  ADD_NAMED_REF_CHOICE_VARIANT("region", m_object, CRegion_pntrs);
513  ADD_NAMED_REF_CHOICE_VARIANT("alignment", m_object, CChem_graph_alignment);
514  ADD_NAMED_REF_CHOICE_VARIANT("interaction", m_object, CChem_graph_interaction);
515  ADD_NAMED_REF_CHOICE_VARIANT("similarity", m_object, CRegion_similarity);
516  ADD_NAMED_REF_CHOICE_VARIANT("indirect", m_object, COther_feature);
517  info->CodeVersion(22301);
518  info->DataSpec(ncbi::EDataSpec::eASN);
519 }
521 
522 // constructor
524  : m_choice(e_not_set)
525 {
526 }
527 
528 // destructor
530 {
531  Reset();
532 }
533 
534 
536 {
537  m_Name.erase();
538  m_set_State[0] &= ~0xc;
539 }
540 
542 {
543  m_Property.Reset();
544 }
545 
547 {
548  m_Property.Reset(&value);
549 }
550 
552 {
553  if ( !m_Property )
554  m_Property.Reset(new TProperty());
555  return (*m_Property);
556 }
557 
559 {
560  m_Location.Reset();
561 }
562 
564 {
565  m_Location.Reset(&value);
566 }
567 
569 {
570  if ( !m_Location )
571  m_Location.Reset(new TLocation());
572  return (*m_Location);
573 }
574 
576 {
577  ResetId();
578  ResetName();
579  ResetType();
580  ResetProperty();
581  ResetLocation();
582 }
583 
585 {
586  SET_CLASS_MODULE("MMDB-Features");
587  ADD_NAMED_MEMBER("id", m_Id, CLASS, (CBiostruc_feature_id))->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
588  ADD_NAMED_STD_MEMBER("name", m_Name)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
589  ADD_NAMED_ENUM_MEMBER("type", m_Type, EType)->SetSetFlag(MEMBER_PTR(m_set_State[0]))->SetOptional();
590  ADD_NAMED_REF_MEMBER("property", m_Property, C_Property)->SetOptional();
591  ADD_NAMED_REF_MEMBER("location", m_Location, C_Location)->SetOptional();
592  info->RandomOrder();
593  info->CodeVersion(22301);
594  info->DataSpec(ncbi::EDataSpec::eASN);
595 }
597 
598 // constructor
601 {
602  memset(m_set_State,0,sizeof(m_set_State));
603 }
604 
605 // destructor
607 {
608 }
609 
610 
611 
612 END_objects_SCOPE // namespace ncbi::objects::
613 
615 
User-defined methods of the data storage class.
BEGIN_NAMED_CHOICE_INFO("", CBiostruc_feature_Base::C_Property)
BEGIN_NAMED_ENUM_IN_INFO("", CBiostruc_feature_Base::, EType, true)
BEGIN_NAMED_BASE_CLASS_INFO("Biostruc-feature", CBiostruc_feature)
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
END_ENUM_INFO
Definition: aln_errors.cpp:58
An explicitly specified type in Biostruc-feature allows for efficient extraction and indexing of feat...
CBiostruc_feature_id –.
CBiostruc_feature –.
CBiostruc_script –.
CCamera –.
Definition: Camera.hpp:66
CChem_graph_alignment –.
CChem_graph_interaction –.
CChem_graph_pntrs –.
CColor_prop –.
Definition: Color_prop.hpp:66
COther_feature –.
CRegion_pntrs –.
CRegion_similarity –.
CTransform –.
Definition: Transform.hpp:66
char value[7]
Definition: config.c:431
string
Definition: cgiapp.hpp:687
#define DIAG_COMPILE_INFO
Make compile time diagnostic information object to use in CNcbiDiag and CException.
Definition: ncbidiag.hpp:170
#define MEMBER_PTR(MemberName)
Definition: serialimpl.hpp:284
#define SET_ENUM_INTERNAL_NAME(OwnerName, MemberName)
Definition: serialimpl.hpp:559
#define ADD_NAMED_MEMBER(MemberAlias, MemberName, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:342
#define ADD_NAMED_REF_MEMBER(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:357
#define SET_ENUM_MODULE(ModuleName)
Definition: serialimpl.hpp:553
#define END_CLASS_INFO
Definition: serialimpl.hpp:456
#define ADD_NAMED_REF_CHOICE_VARIANT(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:400
#define ADD_NAMED_STD_MEMBER(MemberAlias, MemberName)
Definition: serialimpl.hpp:345
#define SET_CLASS_MODULE(ModuleName)
Definition: serialimpl.hpp:444
#define ADD_NAMED_ENUM_MEMBER(MemberAlias, MemberName, EnumName)
Definition: serialimpl.hpp:351
#define ADD_ENUM_VALUE(EnumValueName, EnumValueValue)
Definition: serialimpl.hpp:562
#define ADD_NAMED_ENUM_CHOICE_VARIANT(MemberAlias, MemberName, EnumName)
Definition: serialimpl.hpp:391
#define END_CHOICE_INFO
Definition: serialimpl.hpp:506
#define SET_INTERNAL_NAME(OwnerName, MemberName)
Definition: serialimpl.hpp:447
#define SET_CHOICE_MODULE(ModuleName)
Definition: serialimpl.hpp:500
@ eDoNotResetVariant
Definition: serialbase.hpp:78
void AddReference(void) const
Add reference to object.
Definition: ncbiobj.hpp:489
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
TLocation & SetLocation(void)
Assign a value to Location data member.
void ResetSelection(void)
Reset the selection (set it to e_not_set).
TCamera & SetCamera(void)
Select the variant.
void ResetName(void)
Reset Name data member.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
CBiostruc_feature_id m_Id
TIndirect & SetIndirect(void)
Select the variant.
TColor & SetColor(void)
Select the variant.
const TTransform & GetTransform(void) const
Get the variant data.
CRef< TProperty > m_Property
TTransform & SetTransform(void)
Select the variant.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
const TInteraction & GetInteraction(void) const
Get the variant data.
void Reset(void)
Reset the whole object.
void ResetProperty(void)
Reset Property data member.
const TSimilarity & GetSimilarity(void) const
Get the variant data.
const TRegion & GetRegion(void) const
Get the variant data.
void ResetId(void)
Reset Id data member.
void ResetLocation(void)
Reset Location data member.
static const char *const sm_SelectionNames[]
CRef< TLocation > m_Location
TProperty & SetProperty(void)
Assign a value to Property data member.
static const char *const sm_SelectionNames[]
const TAlignment & GetAlignment(void) const
Get the variant data.
TScript & SetScript(void)
Select the variant.
virtual void Reset(void)
Reset the whole object.
TSubgraph & SetSubgraph(void)
Select the variant.
TInteraction & SetInteraction(void)
Select the variant.
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
void Reset(void)
Reset the whole object.
const TUser & GetUser(void) const
Get the variant data.
TRegion & SetRegion(void)
Select the variant.
TAlignment & SetAlignment(void)
Select the variant.
const TScript & GetScript(void) const
Get the variant data.
virtual ~CBiostruc_feature_Base(void)
ERender_prop
Note that Render-prop is compatible with the Annmm specification, i.e., its numbering schemes do not ...
const TCamera & GetCamera(void) const
Get the variant data.
TSimilarity & SetSimilarity(void)
Select the variant.
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
const TColor & GetColor(void) const
Get the variant data.
void ResetSelection(void)
Reset the selection (set it to e_not_set).
const TSubgraph & GetSubgraph(void) const
Get the variant data.
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
const TIndirect & GetIndirect(void) const
Get the variant data.
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
TUser & SetUser(void)
Select the variant.
void ResetType(void)
Reset Type data member.
unsigned int
A callback function used to compare two keys in a database.
Definition: types.hpp:1210
@ e_not_set
static MDB_envinfo info
Definition: mdb_load.c:37
Modified on Thu Nov 30 04:55:41 2023 by modify_doxy.py rev. 669887