OSSIM - Open Source Software Image Map
Version 1.9.0 (20180803)
|
Utility class providing an interface to ossimTool-derived functionality via TCP sockets Results are returned either as streamed text (for non-image responses such as image info) or streamed binary file representing imagery or vector products. More...
#include <ossimToolClient.h>
Public Member Functions | |
ossimToolClient () | |
~ossimToolClient () | |
Closes any open connections. More... | |
int | connectToServer (char *hostname, char *portname=NULL) |
Accepts hostname and portname as a string. More... | |
bool | setProductFilePath (const char *filepath) |
Sets the local destination directory for file product. More... | |
const char * | getProductFilePath () const |
Returns the filename (including full client-side path) of the local product file waiting after execute(), or NULL if none. More... | |
bool | execute (const char *command_spec) |
Executes OSSIM tool command with options. More... | |
const char * | getTextResponse () const |
Returns the server's text response generated by the execute() call, or NULL if no response available. More... | |
bool | disconnect () |
Closes connection to server and ready to connect again. More... | |
Protected Member Functions | |
void | error (const char *msg) |
bool | receiveText () |
bool | receiveFile () |
bool | acknowledgeRcv () |
Protected Attributes | |
int | m_svrsockfd |
char * | m_buffer |
ossimFilename | m_prodFilePath |
ossimString | m_textResponse |
Utility class providing an interface to ossimTool-derived functionality via TCP sockets Results are returned either as streamed text (for non-image responses such as image info) or streamed binary file representing imagery or vector products.
Code interfacing to this class should know the commands available (or execute the command "help" and view the text response).
Definition at line 20 of file ossimToolClient.h.
ossimToolClient::ossimToolClient | ( | ) |
Definition at line 31 of file ossimToolClient.cpp.
References m_buffer, MAX_BUF_LEN, and setProductFilePath().
ossimToolClient::~ossimToolClient | ( | ) |
Closes any open connections.
Definition at line 43 of file ossimToolClient.cpp.
References disconnect().
|
protected |
Definition at line 288 of file ossimToolClient.cpp.
References _DEBUG_, error(), and m_svrsockfd.
Referenced by receiveFile(), and receiveText().
int ossimToolClient::connectToServer | ( | char * | hostname, |
char * | portname = NULL |
||
) |
Accepts hostname and portname as a string.
Returns socket file descriptor or -1 if error.
Definition at line 73 of file ossimToolClient.cpp.
References ossimString::after(), ossimString::before(), ossimString::contains(), disconnect(), ossimString::empty(), error(), if(), m_svrsockfd, and ossimString::stringDup().
bool ossimToolClient::disconnect | ( | ) |
Closes connection to server and ready to connect again.
Definition at line 48 of file ossimToolClient.cpp.
References error(), and m_svrsockfd.
Referenced by connectToServer(), and ~ossimToolClient().
|
protected |
Definition at line 67 of file ossimToolClient.cpp.
Referenced by acknowledgeRcv(), connectToServer(), disconnect(), execute(), receiveFile(), receiveText(), and setProductFilePath().
bool ossimToolClient::execute | ( | const char * | command_spec | ) |
Executes OSSIM tool command with options.
Examples:
"info -p <server-side-filename>" – Fetches projection info for server side file specified "shoreline -i <server/path/band3.tif>, <server/path/band6.tif> <server/path/output.json>"
Returns TRUE if product generated and received. setProductFilePath() must be called prior to execute() for operations generating file products, otherwise the products are written to the client's temp directory.
Definition at line 142 of file ossimToolClient.cpp.
References _DEBUG_, ossimString::contains(), error(), ossimFilename::isDir(), m_buffer, m_prodFilePath, m_svrsockfd, MAX_BUF_LEN, n, ossimFilename::path(), receiveFile(), and receiveText().
|
inline |
Returns the filename (including full client-side path) of the local product file waiting after execute(), or NULL if none.
Definition at line 49 of file ossimToolClient.h.
|
inline |
Returns the server's text response generated by the execute() call, or NULL if no response available.
Some operations generate both text and file products.
Definition at line 67 of file ossimToolClient.h.
|
protected |
Definition at line 231 of file ossimToolClient.cpp.
References acknowledgeRcv(), ossimString::after(), ossimString::chars(), ossimFilename::dirCat(), error(), m_buffer, m_prodFilePath, m_svrsockfd, m_textResponse, MAX_BUF_LEN, n, receiveText(), and ossimString::toInt().
Referenced by execute().
|
protected |
Definition at line 206 of file ossimToolClient.cpp.
References _DEBUG_, acknowledgeRcv(), ossimString::append(), ossimString::c_str(), ossimString::clear(), error(), m_buffer, m_svrsockfd, m_textResponse, MAX_BUF_LEN, and n.
Referenced by execute(), and receiveFile().
bool ossimToolClient::setProductFilePath | ( | const char * | filepath | ) |
Sets the local destination directory for file product.
The product file name used will match the server-side's file name. This method must be called prior to execute() for operations generating file products, otherwise the products are written to the client's temp directory. If the path directory specified does not exist, it will be created. Returns true if successful.
Definition at line 302 of file ossimToolClient.cpp.
References ossimFilename::createDirectory(), error(), ossimFilename::exists(), ossimFilename::isWriteable(), and m_prodFilePath.
Referenced by ossimToolClient().
|
protected |
Definition at line 83 of file ossimToolClient.h.
Referenced by execute(), ossimToolClient(), receiveFile(), and receiveText().
|
protected |
Definition at line 84 of file ossimToolClient.h.
Referenced by execute(), receiveFile(), and setProductFilePath().
|
protected |
Definition at line 82 of file ossimToolClient.h.
Referenced by acknowledgeRcv(), connectToServer(), disconnect(), execute(), receiveFile(), and receiveText().
|
protected |
Definition at line 85 of file ossimToolClient.h.
Referenced by receiveFile(), and receiveText().