A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/rpcgen_8cpp_source.html below:

NCBI C++ ToolKit: src/serial/datatool/rpcgen.cpp Source File

48 #define NCBI_USE_ERRCODE_X Serial_RPCGen 60  const string

& methodPrefix,

bool

haveUserClass,

61  const string

& classPrefix)

const override

;

71

pos = name.find(

'.'

, pos + 1)) {

72  if

(

islower

((

unsigned char

) name[pos + 1])) {

73  type

.assign(name, 0, pos);

74

field.assign(name, pos + 1,

NPOS

);

84  const string

& element)

87  if

( !element.empty() ) {

90  ITERATE

(vector<string>, subelement, v) {

95

dtype->

GlobalName

() +

" is not a container type"

);

99  if

((*it)->GetName() == *subelement) {

101

dtype = (*it)->GetType()->

Resolve

();

107

dtype->

GlobalName

() +

" has no element "

+ *subelement);

114

dtype->

GlobalName

() +

" is not a choice type"

);

121  if

(element.empty()) {

127

dot = element.find(

'.'

, start);

131

}

while

(dot !=

NPOS

);

137  const string

& section_name,

138  const string

& class_name)

139

: m_Generator(generator), m_SectionName(section_name),

140

m_ClassName(class_name)

145

->GetModules().front().get(),

181

+

", "

+

source

.m_ReplyDataType->ClassName() +

'>'

,

211  string

class_base = class_name +

"_Base"

;

213  string

treq = class_base +

"::TRequest"

;

214  string

trep = class_base +

"::TReply"

;

219  code

.ClassPublic() <<

" typedef " 223  code

.ClassPublic() <<

" typedef " 228  code

.ClassPublic() <<

" typedef " 230

<<

" TRequestChoice;\n"

;

231  code

.ClassPrivate() <<

" CRef<TRequest> m_DefaultRequest;\n\n"

;

233  code

.ClassPublic() <<

" typedef TRequest TRequestChoice;\n"

;

238  code

.ClassPublic() <<

" typedef " 240

<<

" TReplyChoice;\n\n"

;

242  code

.ClassPublic() <<

" typedef TReply TReplyChoice;\n\n"

;

245

<<

" TReplyChoice& x_Choice(TReply& reply);\n"

;

246  code

.MethodStart(

true

)

247

<< trep <<

"Choice& "

<< class_base <<

"::x_Choice("

<< trep

255  string

service = generator.

GetConfig

().

Get

(sect_name,

"service"

);

258  if

(service.empty()) {

264  if

( !

format

.empty() ) {

265

args +=

", eSerial_"

+

format

;

267  code

.AddInitializer(

"Tparent"

, args);

270  code

.AddInitializer(

"m_DefaultRequest"

,

"new TRequest"

);

277

<<

" virtual void Ask(const TRequest& request, TReply& reply);\n" 278

<<

" virtual void Ask(const TRequest& request, TReply& reply,\n" 279

<<

" TReplyChoice::E_Choice wanted);\n\n"

;

281  code

.MethodStart(

true

)

282

<<

"void "

<< class_base <<

"::Ask(const "

<< treq <<

"& request, " 283

<< trep <<

"& reply)\n" 284

<<

"{\n Tparent::Ask(request, reply);\n}\n\n\n"

;

292

<<

" virtual const TRequest& GetDefaultRequest(void) const;\n" 293

<<

" virtual TRequest& SetDefaultRequest(void);\n" 294

<<

" virtual void SetDefaultRequest(const TRequest& request);\n" 296

<<

" virtual void Ask(const TRequestChoice& req, TReply& reply);\n" 297

<<

" virtual void Ask(const TRequestChoice& req, TReply& reply,\n" 298

<<

" TReplyChoice::E_Choice wanted);\n\n"

;

301  code

.MethodStart(

true

)

302

<<

"const "

<< treq <<

"& "

<< class_base

303

<<

"::GetDefaultRequest(void) const\n" 304

<<

"{\n return *m_DefaultRequest;\n}\n\n"

;

305  code

.MethodStart(

true

)

306

<< treq <<

"& "

<< class_base <<

"::SetDefaultRequest(void)\n" 307

<<

"{\n return *m_DefaultRequest;\n}\n\n"

;

308  code

.MethodStart(

true

)

309

<<

"void "

<< class_base <<

"::SetDefaultRequest(const "

<< treq

311

<<

"{\n m_DefaultRequest->Assign(request);\n}\n\n\n"

;

313  code

.MethodStart(

false

)

314

<<

"void "

<< class_base <<

"::Ask(const "

<< treq

315

<<

"Choice& req, "

<< trep <<

"& reply)\n" 317

<<

" TRequest request;\n" 318

<<

" request.Assign(*m_DefaultRequest);\n" 320

<<

" request"

<< setter <<

".Assign(req);\n" 321

<<

" Ask(request, reply);\n" 323  code

.MethodStart(

false

)

324

<<

"void "

<< class_base <<

"::Ask(const "

<< treq

325

<<

"Choice& req, "

<< trep <<

"& reply, "

<< trep

326

<<

"Choice::E_Choice wanted)\n" 328

<<

" TRequest request;\n" 329

<<

" request.Assign(*m_DefaultRequest);\n" 331

<<

" request"

<< setter <<

".Assign(req);\n" 332

<<

" Ask(request, reply, wanted);\n" 341  bool

has_init =

false

, has_fini =

false

, has_error =

false

;

342  ITERATE

(TChoices, it, choices) {

343  const string

& name = (*it)->GetName();

344  if

(name ==

"init"

) {

345  if

(

dynamic_cast<const CNullDataType

*

>

((*it)->GetType())) {

349

(*it)->GetType()->PrintASN(oss, 0);

353

<<

": disabling special init handling because it" 354

<<

" requires a payload of type "

<<

type

);

356

}

else if

(name ==

"fini"

) {

357  if

(

dynamic_cast<const CNullDataType

*

>

((*it)->GetType())) {

361

(*it)->GetType()->PrintASN(oss, 0);

365

<<

": disabling special fini handling because it" 366

<<

" requires a payload of type "

<<

type

);

371  const string

& name = (*it)->GetName();

372

reply_map[name] = it->get();

373  if

(name ==

"error"

) {

379  code

.ClassProtected()

380

<<

" void x_Connect(void);\n"

;

381  code

.MethodStart(

false

)

382

<<

"void "

<< class_base <<

"::x_Connect(void)\n" 384

<<

" Tparent::x_Connect();\n" 389  code

.ClassProtected()

391

<<

" /// Disconnect as cleanly as possible.\n" 393

<<

" /// @note Derived classes that override this method\n" 394

<<

" /// should copy the destructor logic that calls it (via\n" 395

<<

" /// Disconnect, which avoids duplicate calls).\n" 396

<<

" void x_Disconnect(void);\n"

;

397  code

.MethodStart(

false

)

398

<<

"void "

<< class_base <<

"::x_Disconnect(void)\n" 402

<<

" } catch (...) {\n" 403

<<

" Tparent::x_Disconnect();\n" 406

<<

" Tparent::x_Disconnect();\n" 408  code

.AddDestructionCode(

409  "// Copied from ~CRPCClient_Base, whose implicit actions should\n" 410  "// wait, but whose explicit actions should run now so as to\n" 411  "// pick up the correct x_Disconnect implementation.\n" 414  "} STD_CATCH_ALL_XX(Serial_RPCClient, 2," 415  " \"CRPCClient_Base::Disconnect()\");\n"

);

420  code

.MethodStart(

false

)

421

<<

"void "

<< class_base <<

"::Ask(const "

<< treq <<

"& request, " 422

<< trep <<

"& reply, "

<< trep <<

"Choice::E_Choice wanted)\n" 424

<<

" Ask(request, reply);\n" 425

<<

" TReplyChoice& rc = x_Choice(reply);\n" 426

<<

" if (rc.Which() == wanted) {\n" 427

<<

" return; // ok\n"

;

429  code

.Methods(

false

)

430

<<

" } else if (rc.IsError()) {\n" 431

<<

" CNcbiOstrstream oss;\n" 432

<<

" oss << \""

<< class_name

433

<<

": server error: \" << rc.GetError();\n" 434

<<

" NCBI_THROW(CException, eUnknown, CNcbiOstrstreamToString(oss));\n"

;

436  code

.Methods(

false

)

438

<<

" rc.ThrowInvalidSelection(wanted);\n" 443  ITERATE

(TChoices, it, choices) {

445  string

name = (*it)->GetName();

450

}

else if

(reply ==

"special"

) {

454  if

(rm == reply_map.

end

()) {

456  "Invalid reply type "

+ reply +

" for "

+ name);

462  bool

null_req =

false

;

470

typestr->GeneratePointerTypeCode(

code

);

471

req_class = typestr->GetCType(ns);

476  bool

use_cref =

false

;

477  bool

null_rep =

false

;

487

+

"CRef<"

+ rep_type->

ClassName

() +

'>'

;

493

typestr->GeneratePointerTypeCode(

code

);

494

rep_class = typestr->GetCType(ns);

497

<<

" virtual "

<< rep_class <<

' '

<< method <<

"\n"

;

499  code

.ClassPublic() <<

" (TReply* reply = 0);\n\n"

;

501  code

.ClassPublic() <<

" (const "

<< req_class

502

<<

"& req, TReply* reply = 0);\n\n"

;

504  code

.MethodStart(

false

)

505

<< rep_class <<

' '

<< class_base <<

"::"

<< method;

507  code

.Methods(

false

) <<

'('

<< trep <<

"* reply)\n"

;

509  code

.Methods(

false

)

510

<<

"(const "

<< req_class <<

"& req, "

<< trep <<

"* reply)\n"

;

512  code

.Methods(

false

)

514

<<

" TRequestChoice request;\n" 515

<<

" TReply reply0;\n"

;

517  code

.Methods(

false

)

518

<<

" request.Set"

<<

Identifier

(name) <<

"();\n"

;

520  code

.Methods(

false

)

521

<<

" request.Set"

<<

Identifier

(name) <<

"(const_cast<" 522

<< req_class <<

"&>(req));\n"

;

524  code

.Methods(

false

)

525

<<

" if ( !reply ) {\n" 526

<<

" reply = &reply0;\n" 528

<<

" Ask(request, *reply, TReplyChoice::e_"

<<

Identifier

(reply)

531  code

.Methods(

false

) <<

"}\n\n"

;

532

}

else if

(use_cref) {

533  code

.Methods(

false

)

534

<<

" return "

<< rep_class <<

"(&x_Choice(*reply).Set" 538  code

.Methods(

false

)

539

<<

" return x_Choice(*reply).Get"

<<

Identifier

(reply)

CStaticPairArrayMap< CTempString, CSeq_id::E_Choice, PNocase_Generic< CTempString > > TChoiceMap

void SetParentClass(const string &className, const CNamespace &ns, const string &fileName)

void SetHaveTypeInfo(bool haveTypeInfo)

void SetObject(bool isObject)

void SetHaveUserClass(bool haveUserClass)

virtual AutoPtr< CTypeStrings > GenerateCode(void) const override

const CDataType * m_ReplyDataType

const CDataType * m_RequestDataType

const CChoiceDataType * m_ReplyChoiceType

friend class CClientPseudoTypeStrings

CClientPseudoDataType(const CCodeGenerator &generator, const string &section_name, const string &class_name)

const CChoiceDataType * m_RequestChoiceType

const CCodeGenerator & m_Generator

virtual void GenerateClassCode(CClassCode &code, CNcbiOstream &getters, const string &methodPrefix, bool haveUserClass, const string &classPrefix) const override

CClientPseudoTypeStrings(const CClientPseudoDataType &source)

const CClientPseudoDataType & m_Source

CFileSet & GetMainModules(void)

virtual const CMemoryRegistry & GetConfig(void) const override

CDataType * ResolveMain(const string &fullName) const

const TMembers & GetMembers(void) const

list< AutoPtr< CDataMember > > TMembers

string FileName(void) const

virtual AutoPtr< CTypeStrings > GetFullCType(void) const

void SetParent(const CDataType *parent, const string &memberName, string xmlName=kEmptyStr)

const string & GlobalName(void) const

string ClassName(void) const

const CDataType * GetParentType(void) const

virtual const CDataType * Resolve(void) const

bool IsStdType(void) const

const TModuleSets & GetModuleSets(void) const

string GetNamespaceRef(const CNamespace &ns) const

static const CNamespace KNCBINamespace

CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:

const_iterator find(const key_type &key) const

Return a const_iterator pointing to the specified element, or to the end if the element is not found.

const_iterator end() const

Return the end of the controlled sequence.

class CStaticArrayMap<> is an array adaptor that provides an STLish interface to statically-defined a...

TBase::const_iterator const_iterator

#define ITERATE(Type, Var, Cont)

ITERATE macro to sequence through container elements.

#define ERR_POST_X(err_subcode, message)

Error posting with default error code and given error subcode.

#define NCBI_THROW(exception_class, err_code, message)

Generic macro to throw an exception, given the exception class, error code and message string.

void Warning(CExceptionArgs_Base &args)

virtual const string & Get(const string &section, const string &name, TFlags flags=0) const

Get the parameter value.

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

IO_PREFIX::ostream CNcbiOstream

Portable alias for ostream.

NCBI_NS_STD::string::size_type SIZE_TYPE

static string PrintableString(const CTempString str, TPrintableMode mode=fNewLine_Quote|fNonAscii_Passthru)

Get a printable version of the specified string.

static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)

Split a string using specified delimiters.

SStaticPair< const char *, CHistParams::EType > TTypeStr

CHistParams.

Definition of all error codes used in serial libraries (xser.lib, xcser.lib).

The blob sat and sat key Both must be positive integers</td > n< td > Non empty string The interpretation of the blob id depends on a processor Cassandra n processor expects the following format

const CharType(& source)[N]

static const CChoiceDataType * s_ChoiceType(const CDataType *dtype, const string &element)

static void s_SplitName(const string &name, string &type, string &field)

static string s_SetterName(const string &element)

static string s_QualClassName(const CDataType *dt)

string Identifier(const string &typeName, bool capitalize)

Template structure SStaticPair is simlified replacement of STL pair<> Main reason of introducing this...


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4