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/automation_8cpp_source.html below:

NCBI C++ ToolKit: src/app/grid/grid_cli/automation.cpp Source File

51 #define PROTOCOL_VERSION 4 53 #define AUTOMATION_IO_BUFFER_SIZE 4096 55 #define PROTOCOL_ERROR_BASE_RETCODE 20 114  if

(input.IsValid()) {

115  auto

current = input.GetNode();

116  auto

current_type = current.GetNodeType();

141  auto

& input = io.

input

;

143  if

(!input.IsValid()) {

148  auto

current = input.GetNode().AsString();

149  if

(current != name)

return nullptr

;

165  help

.SetString(

"command"

, name);

170  for

(

auto

& element :

m_Args

) elements.

Append

(element.Help());

172  help

.SetByKey(

"arguments"

, elements);

182  for

(

auto

& element :

m_Args

) {

183

element.Exec(name,

input

);

205  help

.SetString(

"command"

, name);

216

args.emplace_back(

input

);

224

m_Commands(group.

first

),

225

m_Check(group.second)

233  help

.SetString(

"command"

, name);

242  if

(sub_help.IsObject())

return

sub_help;

244

elements.

Append

(sub_help);

248  help

.SetByKey(

"sub-topics"

, elements);

266  if

(

auto

new_data = element.Check(io,

data

)) {

267  return

element.Exec(io, new_data);

300  if

(!input.IsValid()) {

305  if

(input.GetNode().AsString() !=

m_Name

) {

337

{

"get_name"

, ExecMethod<TSelf, &TSelf::ExecGetName>, },

338

{

"get_address"

, ExecMethod<TSelf, &TSelf::ExecGetAddress>, {

339

{

"which_part"

, 0, }

342 #ifdef NCBI_GRID_XSITE_CONN_SUPPORT 352  auto

& reply = io.

reply

;

360  auto

& reply = io.

reply

;

361  const auto

which_part = args[

"which_part"

].AsInteger<

int

>();

370

{

"server_info"

, ExecMethod<TSelf, &TSelf::ExecServerInfo>, },

371

{

"exec"

, ExecMethod<TSelf, &TSelf::ExecExec>, {

373

{

"multiline"

,

false

, },

378

cmds.insert(cmds.end(), base_cmds.begin(), base_cmds.end());

385  auto

& reply = io.

reply

;

393  auto

& reply = io.

reply

;

394  const auto command

= args[

"command"

].AsString();

395  const auto multiline

= args[

"multiline"

].AsBoolean();

400

m_MessageSender(message_sender),

403

m_WarnNode(

CJsonNode

::NewStringNode(

"WARNING"

))

458

{

"client_ip"

,

""

, },

460 #ifdef NCBI_GRID_XSITE_CONN_SUPPORT 470  auto

& reply = io.

reply

;

480  const auto

object_id = args[

"object_id"

].AsInteger();

481  auto

&

object

= that->ObjectIdToRef(object_id);

487  auto

& reply = io.

reply

;

489

reply.AppendString(__DATE__);

496  auto

& reply = io.

reply

;

497  const auto

some_id = args[

"some_id"

].AsString();

509  auto

& reply = io.

reply

;

510  for

(

auto

& arg: args) reply.

Append

(arg.Value());

517  const auto

seconds = args[

"seconds"

].AsDouble();

518

this_thread::sleep_for(chrono::duration<double>(seconds));

525  const auto

phid = args[

"phid"

].AsString();

526  const auto

sid = args[

"sid"

].AsString();

527  const auto

client_ip = args[

"client_ip"

].AsString();

530  if

(!phid.empty())

ctx

.SetHitID(phid);

531  if

(!sid.empty())

ctx

.SetSessionID(sid);

532  if

(!client_ip.empty())

ctx

.SetClientIP(client_ip);

537 #ifdef NCBI_GRID_XSITE_CONN_SUPPORT 545  auto

& input = io.

input

;

546  auto

& reply = io.

reply

;

549  if

(!input.IsValid()) {

550

reply.

AppendString

(

"Type `help` (in single quotes) for usage. " 551  "For help on a sub-topic, add it to the command, " 552  "e.g. `help`, `call`, `nstobj`"

);

556  const string help

=

"help"

;

559  if

(input.GetNode().AsString() ==

help

) {

560  return

all_cmds.

Help

(

help

, ++input);

565  if

(!all_cmds.

Exec

(

""

, io,

this

)) {

599  error

.AppendString(error_message);

605  size_t

index = (size_t) (object_id);

609  "Object with id '"

<< object_id <<

"' does not exist"

);

618

m_JSONWriter(json_writer),

623  virtual void

OutputMessage(

const CJsonNode

& message);

626  void

SendOutputBuffer();

634  if

(!m_JSONWriter.WriteMessage(message))

637  while

(!m_JSONWriter.CompleteMessage());

644  const char

* output_buffer;

645  size_t

output_buffer_size;

646  size_t

bytes_written;

649

m_JSONWriter.GetOutputBuffer(&output_buffer, &output_buffer_size);

650  while

(output_buffer_size > 0) {

651  if

(m_Pipe.Write(output_buffer, output_buffer_size,

654  "Error while writing to the pipe"

);

656

output_buffer += bytes_written;

657

output_buffer_size -= bytes_written;

659

}

while

(m_JSONWriter.NextOutputBuffer());

666

FILE* protocol_dump_file);

668  virtual void

InputMessage(

const CJsonNode

& message);

669  virtual void

OutputMessage(

const CJsonNode

& message);

682

FILE* protocol_dump_file) :

683

m_ActualSender(actual_sender),

684

m_ProtocolDumpFile(protocol_dump_file),

685

m_ProtocolDumpTimeFormat(

"Y/M/D h:m:s.l"

)

727

_setmode(_fileno(stdin), O_BINARY);

728

_setmode(_fileno(stdout), O_BINARY);

737

writer.

Reset

(write_buf,

sizeof

(write_buf));

749

message_sender = &actual_message_sender;

751

message_sender = &dumper_and_sender;

778  if

(e.

GetErrCode

() == CAutomationException::eInvalidInput)

return

2;

784

json_reader.

Reset

();

795 #define DEBUG_CONSOLE_PROMPT ">>> " 801  "Press ^D or type \"exit\" (in double qoutes) to quit.\n" 815  if

(!

proc

.Process(input_message))

return

0;

822

printf(

"%*c syntax error\n"

,

int

(e.

GetPos

() +

CJsonNode g_ExecAnyCmdToJson(CNetService service, const string &command, bool multiline)

void g_PrintJSON(FILE *output_stream, CJsonNode node, const char *indent)

CJsonNode g_WhatIs(const string &id, CCompoundIDPool id_pool)

#define AUTOMATION_IO_BUFFER_SIZE

#define PROTOCOL_ERROR_BASE_RETCODE

#define DEBUG_CONSOLE_PROMPT

bool IsOptionSet(int option) const

struct CGridCommandLineInterfaceApp::SOptions m_Opts

int Automation_PipeServer()

int Automation_DebugConsole()

Iterator for JSON arrays and objects.

static CJsonNode NewArrayNode()

Create a new JSON array node.

string GetTypeName() const

Return a string identifying the node type.

void AppendInteger(Int8 value)

For an array node, add a integer node at the end of the array.

void AppendString(const string &value)

For an array node, add a string node at the end of the array.

static CJsonNode ParseArray(const string &json, TParseFlags flags=0)

ENodeType GetNodeType() const

Return a ENodeType constant identifying the node type.

static CJsonNode NewIntegerNode(Int8 value)

Create a new JSON integer node.

static CJsonNode NewStringNode(const string &value)

Create a new JSON string node.

void Append(CJsonNode::TInstance value)

For an array node, add a new element at the end of the array.

Exception class for use by CJsonNode.

const CJsonNode GetMessage() const

bool ReadMessage(CUTTPReader &reader)

virtual void OutputMessage(const CJsonNode &message)

CMessageDumperSender(IMessageSender *actual_sender, FILE *protocol_dump_file)

string m_DumpInputHeaderFormat

string m_ProtocolDumpTimeFormat

virtual void InputMessage(const CJsonNode &message)

FILE * m_ProtocolDumpFile

string m_DumpOutputHeaderFormat

IMessageSender * m_ActualSender

CMessageSender(CJsonOverUTTPWriter &json_writer, CPipe &pipe)

virtual void OutputMessage(const CJsonNode &message)

CJsonOverUTTPWriter & m_JSONWriter

const SSocketAddress & GetAddress() const

unsigned short GetPort() const

string GetServerAddress() const

static void AllowXSiteConnections()

CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...

Class for reading series of chunks sent by a CUTTPWriter instance as a stream of bytes.

void SetNewBuffer(const char *buffer, size_t buffer_size)

Start processing of the next chunk of data.

Class that serializes series of chunks of data for sending over binary streams.

void Reset(char *buffer, size_t buffer_size)

Initialize or reinitialize this object.

CJsonNode m_TypeOrDefaultValue

void Exec(const string &name, CJsonIterator &input)

static TCommands Commands()

static void ExecVersion(const TArguments &args, SInputOutput &io, void *data)

static void ExecDel(const TArguments &args, SInputOutput &io, void *data)

vector< TAutomationObjectRef > m_ObjectByIndex

static TCommands NewCommands()

static void ExecEcho(const TArguments &args, SInputOutput &io, void *data)

static void ExecSleep(const TArguments &args, SInputOutput &io, void *data)

static TCommands CallCommands()

void SendWarning(const string &warn_msg, TAutomationObjectRef source)

bool Process(const CJsonNode &message)

void SendError(const CTempString &error_message)

static void ExecExit(const TArguments &args, SInputOutput &io, void *data)

static void ExecWhatIs(const TArguments &args, SInputOutput &io, void *data)

TAutomationObjectRef & ObjectIdToRef(TObjectID object_id)

static void ExecAllowXSite(const TArguments &args, SInputOutput &io, void *data)

CJsonNode ProcessMessage(const CJsonNode &message)

IMessageSender * m_MessageSender

CAutomationProc(IMessageSender *message_sender)

static void ExecSetContext(const TArguments &args, SInputOutput &io, void *data)

void * Check(SInputOutput &io, void *data)

shared_ptr< SCommandImpl > m_Impl

bool Exec(SInputOutput &io, void *data)

CJsonNode Help(CJsonIterator &input)

CCommand(string name, TCommandExecutor exec, TArgsInit args=TArgsInit())

virtual void OutputMessage(const CJsonNode &)=0

virtual void InputMessage(const CJsonNode &)

static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)

CDiagContext & GetDiagContext(void)

Get diag context instance.

static CRequestContext & GetRequestContext(void)

Shortcut to CDiagContextThreadData::GetThreadData().GetRequestContext()

@ eDPF_Log

Print the posted message only; without severity, location, prefix, etc.

TErrCode GetErrCode(void) const

Get error code.

#define NCBI_THROW(exception_class, err_code, message)

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

string ReportThis(TDiagPostFlags flags=eDPF_Exception) const

Report this exception only.

#define NCBI_THROW_FMT(exception_class, err_code, message)

The same as NCBI_THROW but with message processed as output to ostream.

void OpenSelf(void)

Open the standard streams of the current process.

EIO_Status Read(void *buf, size_t count, size_t *read=0, EChildIOHandle from_handle=eDefault)

Read data from the pipe's default read handle.

int64_t Int8

8-byte (64-bit) signed integer

static TPid GetPid(void)

Get process identifier (pid) for the current process.

#define NCBI_AS_STRING(value)

Convert some value to string even if this value is macro itself.

string::size_type GetPos(void) const noexcept

Get error position.

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.

CTime GetFastLocalTime(void)

Quick and dirty getter of local time.

@ eIO_Success

everything is fine, no error occurred

pair< TCommands, TCommandChecker > TCommandGroup

initializer_list< CArgument > TArgsInit

vector< CCommand > TCommands

function< void(const TArguments &, SInputOutput &, void *)> TCommandExecutor

function< void *(const string &, SInputOutput &, void *)> TCommandChecker

void Check(const string &value)

const CharType(& source)[N]

Portable class to work with a spawned process via pipes.

CJsonNode g_ServerInfoToJson(CNetServerInfo server_info, bool server_version_key)

CJsonNode g_ExecToJson(IExecToJson &exec_to_json, CNetService service, CNetService::EIterationMode iteration_mode=CNetService::eSortByLoad)

This function is for use by the grid_cli utility only.

Defines CRequestContext class for NCBI C++ diagnostic API.

virtual bool Exec(const string &name, SInputOutput &io, void *data)=0

virtual void * Check(const string &name, SInputOutput &io, void *data)

virtual CJsonNode Help(const string &name, CJsonIterator &input)=0

static CCommand CallCommand()

static CCommand NewCommand()

static CCommand CallCommand()

static CCommand CallCommand()

static CCommand NewCommand()

static CCommand CallCommand()

static CCommand NewCommand()

static CCommand NewCommand()

static CCommand CallCommand()

void ExecGetName(const TArguments &args, SInputOutput &io)

void ExecGetAddress(const TArguments &args, SInputOutput &io)

virtual CNetService GetService()=0

static TCommands CallCommands()

void ExecExec(const TArguments &args, SInputOutput &io)

static TCommands CallCommands()

void ExecServerInfo(const TArguments &args, SInputOutput &io)

static CCommand CallCommand()

static CCommand CallCommand()

static CCommand NewCommand()

static CCommand NewCommand()

static CCommand CallCommand()

virtual CJsonNode ExecOn(CNetServer server)

static CCommand NewCommand()

static CCommand CallCommand()

CJsonNode Help(const string &name, CJsonIterator &input) override

SCommandGroupImpl(TCommandGroup group)

void * Check(const string &name, SInputOutput &io, void *data) override

bool Exec(const string &name, SInputOutput &io, void *data) override

CJsonNode Help(const string &name, CJsonIterator &input) override

SSimpleCommandImpl(TArgsInit args, TCommandExecutor exec)

bool Exec(const string &name, SInputOutput &io, void *data) override

string GetHostName() const

SVariadicCommandImpl(string args, TCommandExecutor exec)

CJsonNode Help(const string &name, CJsonIterator &input) override

bool Exec(const string &name, SInputOutput &io, void *data) override

unsigned read_buf(z_streamp strm, Bytef *buf, unsigned size)


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