0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Tools::client::fsbroker::CommandInterpreter Class Reference

Command interpreter for ht_fsbroker. More...

#include <CommandInterpreter.h>

Inheritance diagram for Tools::client::fsbroker::CommandInterpreter:
Inheritance graph
[legend]
Collaboration diagram for Tools::client::fsbroker::CommandInterpreter:
Collaboration graph
[legend]

Classes

class  ParseResult
 

Public Member Functions

 CommandInterpreter (FsBroker::Lib::ClientPtr &client, bool nowait=false)
 Constructor. More...
 
int execute_line (const String &line) override
 
- Public Member Functions inherited from Hypertable::CommandInterpreter
 CommandInterpreter ()
 
void set_timestamp_output_format (const String &format)
 
void set_silent (bool silent)
 
void set_test_mode (bool mode)
 
void set_interactive_mode (bool mode)
 
bool silent_mode ()
 
bool test_mode ()
 
bool normal_mode ()
 
int timestamp_output_format ()
 

Private Member Functions

void parse_line (const String &line, ParseResult &result) const
 Parses a single command. More...
 
void load_help_text ()
 Loads help text. More...
 
void display_help_text (const std::string &command) const
 Displays help text for command. More...
 
void display_usage (const std::string &command) const
 Displays usage for command. More...
 
void parse_error (const std::string &command) const
 

Private Attributes

FsBroker::Lib::ClientPtr m_client
 File system client. More...
 
std::unordered_map
< std::string, const char ** > 
m_help_text
 Map of help text. More...
 
bool m_nowait
 Don't wait for certain commands to complete (e.g. shutdown) More...
 

Additional Inherited Members

- Public Types inherited from Hypertable::CommandInterpreter
enum  { TIMESTAMP_FORMAT_DEFAULT, TIMESTAMP_FORMAT_NANOS }
 
- Protected Attributes inherited from Hypertable::CommandInterpreter
int m_timestamp_output_format
 
bool m_silent
 
bool m_test_mode
 
bool m_interactive
 

Detailed Description

Command interpreter for ht_fsbroker.

Definition at line 50 of file CommandInterpreter.h.

Constructor & Destructor Documentation

Tools::client::fsbroker::CommandInterpreter::CommandInterpreter ( FsBroker::Lib::ClientPtr client,
bool  nowait = false 
)
inline

Constructor.

Initializes m_client with client and m_nowait with nowait. Also loads help text with a call to load_help_text().

Parameters
clientFile system client
nowaitNo wait flag

Definition at line 59 of file CommandInterpreter.h.

Member Function Documentation

void fsbroker::CommandInterpreter::display_help_text ( const std::string &  command) const
private

Displays help text for command.

Searches m_help_text for help text for command and displays it if found.

Parameters
commandCommand for which to display help text

Definition at line 371 of file CommandInterpreter.cc.

void fsbroker::CommandInterpreter::display_usage ( const std::string &  command) const
private

Displays usage for command.

Searches m_help_text for help text for command and displays the first line, which is the command usage.

Parameters
commandCommand for which to display help text

Definition at line 386 of file CommandInterpreter.cc.

int fsbroker::CommandInterpreter::execute_line ( const String line)
overridevirtual

Implements Hypertable::CommandInterpreter.

Definition at line 72 of file CommandInterpreter.cc.

void fsbroker::CommandInterpreter::load_help_text ( )
private

Loads help text.

Populates m_help_text with help text for supported commands.

Definition at line 357 of file CommandInterpreter.cc.

void fsbroker::CommandInterpreter::parse_error ( const std::string &  command) const
private

Definition at line 395 of file CommandInterpreter.cc.

void fsbroker::CommandInterpreter::parse_line ( const String line,
ParseResult result 
) const
private

Parses a single command.

Parameters
lineString containing command to parse
resultReference to variable to hold parse result

Definition at line 165 of file CommandInterpreter.cc.

Member Data Documentation

FsBroker::Lib::ClientPtr Tools::client::fsbroker::CommandInterpreter::m_client
private

File system client.

Definition at line 100 of file CommandInterpreter.h.

std::unordered_map<std::string, const char **> Tools::client::fsbroker::CommandInterpreter::m_help_text
private

Map of help text.

Definition at line 103 of file CommandInterpreter.h.

bool Tools::client::fsbroker::CommandInterpreter::m_nowait
private

Don't wait for certain commands to complete (e.g. shutdown)

Definition at line 106 of file CommandInterpreter.h.


The documentation for this class was generated from the following files: