41 #ifndef OBJECTS_GENERAL_USER_FIELD_BASE_HPP
42 #define OBJECTS_GENERAL_USER_FIELD_BASE_HPP
53 #ifndef BEGIN_objects_SCOPE
54 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
55 # define END_objects_SCOPE END_SCOPE(objects)
135 void ResetSelection(
void);
141 E_Choice Which(
void)
const;
147 void CheckSelected(E_Choice index)
const;
153 NCBI_NORETURN
void ThrowInvalidSelection(E_Choice index)
const;
161 static string SelectionName(E_Choice index);
183 typedef vector< char >
TOs;
185 typedef vector< CStringUTF8 >
TStrs;
188 typedef vector< vector< char >* >
TOss;
189 typedef vector< CRef< CUser_field > >
TFields;
202 bool IsStr(
void)
const;
208 const TStr& GetStr(
void)
const;
229 bool IsInt(
void)
const;
235 TInt GetInt(
void)
const;
256 bool IsReal(
void)
const;
262 TReal GetReal(
void)
const;
268 TReal& SetReal(
void);
283 bool IsBool(
void)
const;
289 TBool GetBool(
void)
const;
295 TBool& SetBool(
void);
310 bool IsOs(
void)
const;
316 const TOs& GetOs(
void)
const;
331 bool IsObject(
void)
const;
337 const TObject& GetObject(
void)
const;
357 bool IsStrs(
void)
const;
363 const TStrs& GetStrs(
void)
const;
369 TStrs& SetStrs(
void);
378 bool IsInts(
void)
const;
384 const TInts& GetInts(
void)
const;
390 TInts& SetInts(
void);
399 bool IsReals(
void)
const;
405 const TReals& GetReals(
void)
const;
420 bool IsOss(
void)
const;
426 const TOss& GetOss(
void)
const;
441 bool IsFields(
void)
const;
447 const TFields& GetFields(
void)
const;
462 bool IsObjects(
void)
const;
486 static const char*
const sm_SelectionNames[];
492 NCBI_NS_NCBI::CUnionBuffer<TOs>
m_Os;
493 NCBI_NS_NCBI::CUnionBuffer<TStrs>
m_Strs;
494 NCBI_NS_NCBI::CUnionBuffer<TInts>
m_Ints;
496 NCBI_NS_NCBI::CUnionBuffer<TOss>
m_Oss;
528 bool IsSetLabel(
void)
const;
535 bool CanGetLabel(
void)
const;
538 void ResetLabel(
void);
566 bool IsSetNum(
void)
const;
573 bool CanGetNum(
void)
const;
582 TNum GetNum(
void)
const;
603 bool IsSetData(
void)
const;
610 bool CanGetData(
void)
const;
613 void ResetData(
void);
619 const TData& GetData(
void)
const;
631 TData& SetData(
void);
634 virtual void Reset(
void);
667 if ( m_choice != index )
668 ThrowInvalidSelection(index);
677 DoSelect(index, pool);
684 Select(index, reset, 0);
690 return m_choice == e_Str;
696 CheckSelected(e_Str);
697 return *m_string_utf8;
704 return *m_string_utf8;
710 return m_choice == e_Int;
716 CheckSelected(e_Int);
737 return m_choice == e_Real;
743 CheckSelected(e_Real);
764 return m_choice == e_Bool;
770 CheckSelected(e_Bool);
791 return m_choice == e_Os;
811 return m_choice == e_Object;
817 return m_choice == e_Strs;
823 CheckSelected(e_Strs);
837 return m_choice == e_Ints;
843 CheckSelected(e_Ints);
857 return m_choice == e_Reals;
863 CheckSelected(e_Reals);
877 return m_choice == e_Oss;
883 CheckSelected(e_Oss);
897 return m_choice == e_Fields;
903 CheckSelected(e_Fields);
917 return m_choice == e_Objects;
923 CheckSelected(e_Objects);
Base class for all serializable objects.
vector< CConstRef< CObject > > GetObjects(CSeq_entry_Handle seh, const string &field, CFieldNamePanel::EFieldType field_type, int subtype, const string &ncRNA_class, CConstRef< objects::CSeq_submit > submit, CRef< CEditingActionConstraint > constraint, vector< CSeq_entry_Handle > *descr_context=nullptr)
static char UnassignedByte(void)
void ThrowUnassigned(TMemberIndex index) const
string GetLabel(const CSeq_id &id)
bool NotEmpty(void) const THROWS_NONE
Check if CRef is not empty – pointing to an object and has a non-null value.
uint32_t Uint4
4-byte (32-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define NCBI_GENERAL_EXPORT
TOs & SetOs(void)
Select the variant.
const TStr & GetStr(void) const
Get the variant data.
TFields & SetFields(void)
Select the variant.
void ResetLabel(void)
Reset Label data member.
NCBI_NS_NCBI::CUnionBuffer< TObjects > m_Objects
CUser_field_Base(const CUser_field_Base &)
bool IsStrs(void) const
Check if variant Strs is selected.
const TStrs & GetStrs(void) const
Get the variant data.
const TData & GetData(void) const
Get the Data member data.
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
bool CanGetData(void) const
Check if it is safe to call GetData method.
const TOss & GetOss(void) const
Get the variant data.
CUser_field_Base & operator=(const CUser_field_Base &)
TInt & SetInt(void)
Select the variant.
const TFields & GetFields(void) const
Get the variant data.
TOss & SetOss(void)
Select the variant.
vector< CRef< CUser_field > > TFields
TBool GetBool(void) const
Get the variant data.
vector< vector< char > * > TOss
bool CanGetNum(void) const
Check if it is safe to call GetNum method.
NCBI_NS_NCBI::CUnionBuffer< TFields > m_Fields
bool IsFields(void) const
Check if variant Fields is selected.
bool IsInt(void) const
Check if variant Int is selected.
TData & SetData(void)
Assign a value to Data data member.
bool IsStr(void) const
Check if variant Str is selected.
NCBI_NS_NCBI::CUnionBuffer< TStrs > m_Strs
NCBI_NS_NCBI::CUnionBuffer< TReals > m_Reals
vector< CRef< CUser_object > > TObjects
bool IsSetLabel(void) const
field label Check if a value has been assigned to Label data member.
void Select(E_Choice index, EResetVariant reset, CObjectMemoryPool *pool)
Select the requested variant if needed, allocating CObject variants from memory pool.
bool IsSetNum(void) const
required for strs, ints, reals, oss Check if a value has been assigned to Num data member.
TStr & SetStr(void)
Select the variant.
TLabel & SetLabel(void)
Assign a value to Label data member.
TInt GetInt(void) const
Get the variant data.
bool IsInts(void) const
Check if variant Ints is selected.
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
TReal & SetReal(void)
Select the variant.
bool IsObjects(void) const
Check if variant Objects is selected.
NCBI_NS_NCBI::CUnionBuffer< TOss > m_Oss
bool IsOss(void) const
Check if variant Oss is selected.
C_Data & operator=(const C_Data &)
TObjects & SetObjects(void)
Select the variant.
TReal GetReal(void) const
Get the variant data.
DECLARE_INTERNAL_TYPE_INFO()
TReals & SetReals(void)
Select the variant.
TInts & SetInts(void)
Select the variant.
NCBI_NS_NCBI::CSerialObject * m_object
TBool & SetBool(void)
Select the variant.
TNum & SetNum(void)
Assign a value to Num data member.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
const TReals & GetReals(void) const
Get the variant data.
void ResetNum(void)
Reset Num data member.
DECLARE_INTERNAL_TYPE_INFO()
bool IsReal(void) const
Check if variant Real is selected.
const TLabel & GetLabel(void) const
Get the Label member data.
NCBI_NS_NCBI::CUnionBuffer< CStringUTF8 > m_string_utf8
bool IsObject(void) const
Check if variant Object is selected.
Tparent::CMemberIndex< E_memberIndex, 4 > TmemberIndex
bool IsSetData(void) const
Check if a value has been assigned to Data data member.
bool IsOs(void) const
Check if variant Os is selected.
TStrs & SetStrs(void)
Select the variant.
vector< CStringUTF8 > TStrs
bool CanGetLabel(void) const
Check if it is safe to call GetLabel method.
bool IsBool(void) const
Check if variant Bool is selected.
void ResetData(void)
Reset Data data member.
NCBI_NS_NCBI::CUnionBuffer< TInts > m_Ints
bool IsReals(void) const
Check if variant Reals is selected.
const TOs & GetOs(void) const
Get the variant data.
NCBI_NS_NCBI::CUnionBuffer< TOs > m_Os
E_Choice Which(void) const
Which variant is currently selected.
const TInts & GetInts(void) const
Get the variant data.
const TObjects & GetObjects(void) const
Get the variant data.
TNum GetNum(void) const
Get the Num member data.
@ e_Object
for using other definitions