34 #ifndef OBJTOOLS_BLASTDB_FORMAT___BLASTDB_SEQID__HPP
35 #define OBJTOOLS_BLASTDB_FORMAT___BLASTDB_SEQID__HPP
46 static const int kInvalid = -1;
61 m_EntrySpecified.m_SequenceId =
new string(entry);
62 m_EntryChoice = eSeqId;
68 m_EntrySpecified.m_PIG = pig;
88 delete m_EntrySpecified.m_SequenceId;
95 switch (m_EntryChoice) {
98 case eSeqId: retval =
"'" + GetStringId() +
"'";
break;
114 out <<
id.AsString();
119 bool IsGi()
const {
return m_EntryChoice ==
eGi; }
125 bool IsOID()
const {
return m_EntryChoice ==
eNone || m_OID != kInvalid; }
130 int GetPig()
const {
return m_EntrySpecified.m_PIG; }
132 const string&
GetStringId()
const {
return *m_EntrySpecified.m_SequenceId; }
169 m_EntrySpecified.m_SequenceId =
Encapsulates identifier to retrieve data from a BLAST database.
CBlastDBSeqId()
Default constructor, creates an invalid object.
EEntryChoices m_EntryChoice
Choice of entry set, only valid if.
bool IsPig() const
Does this object contain a PIG?
CBlastDBSeqId(const CBlastDBSeqId &rhs)
Copy constructor.
CBlastDBSeqId(const string &entry)
Constructor which takes a string as input, can be a GI, accession, NCBI Seq-id.
CBlastDBSeqId & operator=(const CBlastDBSeqId &rhs)
Assignment operator.
friend ostream & operator<<(ostream &out, const CBlastDBSeqId &id)
Stream insertion operator.
CSeqDB::TOID GetOID() const
Retrieve this object's OID.
static const int kInvalid
Default value for an invalid entry.
const string & GetStringId() const
Retrieve this object's string identifier.
string * m_SequenceId
Store a sequence identifier as a string.
CSeqDB::TOID m_OID
This object's OID.
bool IsStringId() const
Does this object contain a string identifier?
bool IsOID() const
Does this object contain an OID?
union CBlastDBSeqId::@747 m_EntrySpecified
Union to hold the memory of the data stored.
bool IsGi() const
Does this object contain a GI?
int GetPig() const
Retrieve this object's PIG.
EEntryChoices
Enumeration to distinguish the types of entries stored by this object.
void do_copy(const CBlastDBSeqId &rhs)
Copies an object of this type.
TIntId GetGi() const
Retrieve this object's GI.
void SetOID(CSeqDB::TOID oid)
Set this object's OID.
string AsString() const
Convert this object to a string.
~CBlastDBSeqId()
Destructor.
CBlastDBSeqId(int pig)
Constructor which takes a PIG as input.
int TOID
Sequence type accepted and returned for OID indices.
std::ofstream out("events_result.xml")
main entry point for tests
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static long StringToLong(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to long.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
#define NCBI_BLASTDB_FORMAT_EXPORT
Defines BLAST database access classes.
bool IsStringId(const CSeq_id &id)
Determine if id is srting id.
@ ePig
Protein Identifier Group.