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

Go to the SVN repository for this file.

1 /* $Id: sage_manip.cpp 55113 2012-07-17 15:33:42Z ivanov $
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: Mike DiCuccio
27  *
28  * File Description:
29  * CSageManip -- manipulator for SAGE data; encodes/decodes from
30  * a CUser_object
31  */
32 
33 #include <ncbi_pch.hpp>
36 
37 
40 
41 
42 static const char* sc_tag = "tag";
43 static const char* sc_count = "count";
44 static const char* sc_method = "method";
45 
46 
47 
49  : m_Object(const_cast<CUser_object*>(&obj))
50 {
51 }
52 
53 
55 {
56 }
57 
58 
59 const string& CConstSageData::GetTag(void) const
60 {
61  return m_Object->GetField(sc_tag).GetData().GetStr();
62 }
63 
64 
65 int CConstSageData::GetCount(void) const
66 {
68 }
69 
70 
71 const CUser_field& CConstSageData::GetField(const string& field,
72  const string& delim)
73 {
74  return m_Object->GetField(field, delim);
75 }
76 
77 
78 
80  : CConstSageData(obj)
81 {
82 }
83 
84 
85 string& CSageData::SetTag(void)
86 {
87  return m_Object->SetField(sc_tag).SetData().SetStr();
88 }
89 
90 
91 void CSageData::SetTag(const string& str)
92 {
93  m_Object->SetField(sc_tag).SetData().SetStr(str);
94 }
95 
96 
97 string& CSageData::SetMethod(void)
98 {
99  return m_Object->SetField(sc_method).SetData().SetStr();
100 }
101 
102 
103 void CSageData::SetMethod(const string& str)
104 {
105  m_Object->SetField(sc_method).SetData().SetStr(str);
106 }
107 
108 
109 void CSageData::SetCount(int count)
110 {
111  m_Object->SetField(sc_count).SetData().SetInt(count);
112 }
113 
114 
115 CUser_field& CSageData::SetField(const string& field)
116 {
117  return m_Object->SetField(field);
118 }
119 
120 
121 CUser_field& CSageData::SetField(const string& field, const string& value)
122 {
123  CUser_field& f = m_Object->SetField(field);
124  f.SetData().SetStr(value);
125  return f;
126 }
127 
128 
CSageData(CUser_object &obj)
Definition: sage_manip.cpp:79
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:73
void SetData(TData &value)
Assign a value to Data data member.
const TStr & GetStr(void) const
Get the variant data.
const CUser_field & GetField(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase) const
Access a named field in this user object.
Definition: User_object.cpp:67
const TData & GetData(void) const
Get the Data member data.
const string & GetTag(void) const
Definition: sage_manip.cpp:59
string & SetTag(void)
Definition: sage_manip.cpp:85
static const char * sc_tag
Definition: sage_manip.cpp:42
CRef< CUser_object > m_Object
Definition: sage_manip.hpp:61
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:101
static const char * sc_count
Definition: sage_manip.cpp:43
const CUser_field & GetField(const string &field, const string &delim=".")
Definition: sage_manip.cpp:71
const char * tag
CUser_field & SetField(const string &str, const string &delim=".", const string &obj_subtype=kEmptyStr, NStr::ECase use_case=NStr::eCase)
Access a named field in this user object.
double f(double x_, const double &y_)
Definition: njn_root.hpp:188
int GetCount(void) const
Definition: sage_manip.cpp:65
CUser_field & SetField(const string &field)
Definition: sage_manip.cpp:115
char value[7]
Definition: config.c:428
TInt GetInt(void) const
Get the variant data.
virtual ~CConstSageData()
Definition: sage_manip.cpp:54
static const char * str(char *buf, int n)
Definition: stats.c:84
void SetCount(int count)
Definition: sage_manip.cpp:109
string & SetMethod(void)
Definition: sage_manip.cpp:97
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:70
#define const
Definition: zconf.h:217
static const char * sc_method
Definition: sage_manip.cpp:44
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:98
Modified on Tue Jul 25 19:53:46 2017 by modify_doxy.py rev. 533848