;
57 return "eCommandProcessingError";
72 input(message.Iterate()),
90 template<
typenameTValue>
103 template<
typenameTInt = Int8>
125 autofound = [&](
const CArgument& arg) {
returnname == arg.
Name(); };
126 const auto result= find_if(begin(), end(), found);
187 template<
classTDerived>
190 template<
classTDerived>
193 template<
classTClass,
void(TClass::*Method)(const TArguments&, SInputOutput& io)>
300new_object->SetID(new_object_id);
302 returnnew_object_id;
305 template<
classTDerived>
311 auto& input = io.
input;
317 autoobject_id = input.GetNode().AsInteger();
318 auto& object_ref = that->ObjectIdToRef(object_id);
320 if(name != object_ref->GetType())
return nullptr;
323 returnobject_ref.GetPointer();
326 template<
classTDerived>
332 auto& reply = io.
reply;
337new_object.
Reset(TDerived::Create(args, that));
344 auto id= that->AddObject(new_object);
345reply.AppendInteger(
id);
348 template<
classTClass,
void(TClass::*Method)(const TArguments&, SInputOutput& io)>
353 autothat =
static_cast<TClass*
>(
data);
354(that->*Method)(args, io);
Iterator for JSON arrays and objects.
Int8 AsInteger() const
Provided that this is a numeric node (that is, either an integer or a floating point node),...
const string AsString() const
Provided that this is a string node, return the string value of this node.
bool AsBoolean() const
Provided that this is a boolean node, return the boolean value of this node.
ENodeType
JSON node type.
double AsDouble() const
Provided that this is a numeric node (that is, either a floating point or an integer node),...
CNetServiceIterator Iterate(EIterationMode mode=eSortByLoad)
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
This class is for use by the grid_cli utility only.
CJsonNode m_TypeOrDefaultValue
void Exec(const string &name, CJsonIterator &input)
CArgument(string name, CJsonNode::ENodeType type)
CArgument(string name, const TValue &value)
CArgument(CJsonIterator &input)
@ eCommandProcessingError
NCBI_EXCEPTION_DEFAULT(CAutomationException, CException)
virtual const char * GetErrCodeString(void) const override
Get error code interpreted as text.
static void ExecNew(const TArguments &args, SInputOutput &io, void *data)
void SetID(TObjectID object_id)
static void ExecMethod(const TArguments &args, SInputOutput &io, void *data)
CAutomationObject(CAutomationProc *automation_proc)
virtual const string & GetType() const =0
static void * CheckCall(const string &name, SInputOutput &io, void *data)
CAutomationProc * m_AutomationProc
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)
TObjectID AddObject(TAutomationObjectRef new_object)
static void ExecSleep(const TArguments &args, SInputOutput &io, void *data)
static TCommands CallCommands()
void SendWarning(const string &warn_msg, TAutomationObjectRef source)
TAutomationObjectRef ReturnNetScheduleServerObject(CNetScheduleAPI::TInstance ns_api, CNetServer::TInstance server)
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 ReturnNetStorageServerObject(CNetStorageAdmin::TInstance nst_api, CNetServer::TInstance server)
TAutomationObjectRef & ObjectIdToRef(TObjectID object_id)
TAutomationObjectRef ReturnNetCacheServerObject(CNetICacheClient::TInstance ic_api, CNetServer::TInstance server)
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 ~IMessageSender()
virtual void InputMessage(const CJsonNode &)
TErrCode GetErrCode(void) const
Get error code.
const string & GetMsg(void) const
Get message string.
EErrCode
Error types that an application can generate.
#define NCBI_THROW_FMT(exception_class, err_code, message)
The same as NCBI_THROW but with message processed as output to ostream.
virtual const char * GetErrCodeString(void) const
Get error code interpreted as text.
void Reset(void)
Reset reference object.
int64_t Int8
8-byte (64-bit) signed integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
pair< TCommands, TCommandChecker > TCommandGroup
initializer_list< CArgument > TArgsInit
CRef< CAutomationObject > TAutomationObjectRef
vector< CCommand > TCommands
function< void(const TArguments &, SInputOutput &, void *)> TCommandExecutor
function< void *(const string &, SInputOutput &, void *)> TCommandChecker
const GenericPointer< typename T::ValueType > T2 value
const CharType(& source)[N]
SInputOutput(const CJsonNode &message)
void ExecGetName(const TArguments &args, SInputOutput &io)
void ExecGetAddress(const TArguments &args, SInputOutput &io)
virtual CNetService GetService()=0
SNetServiceBase(CAutomationProc *automation_proc)
static TCommands CallCommands()
SNetService(CAutomationProc *automation_proc)
void ExecExec(const TArguments &args, SInputOutput &io)
static TCommands CallCommands()
void ExecServerInfo(const TArguments &args, SInputOutput &io)
SServerAddressToJson(int which_part)
virtual CJsonNode ExecOn(CNetServer server)
const CArgument & operator[](const char *name) const
TArguments(TArgsInit args)
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