OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimTool.h
Go to the documentation of this file.
1 //**************************************************************************************************
2 //
3 // OSSIM Open Source Geospatial Data Processing Library
4 // See top level LICENSE.txt file for license information
5 //
6 //**************************************************************************************************
7 
8 #ifndef ossimUtility_HEADER
9 #define ossimUtility_HEADER 1
10 
12 #include <ossim/base/ossimObject.h>
16 #include <iostream>
17 
23 
24 {
25 public:
26  ossimTool();
27  virtual ~ossimTool();
28 
38  virtual bool initialize(ossimArgumentParser& ap);
39 
45  virtual void initialize(const ossimKeywordlist& kwl);
46 
52  virtual void loadJSON(const Json::Value& json_request) {};
53 
59  virtual void saveJSON(Json::Value& json) const { json.clear(); }
60 
65  virtual bool execute() = 0;
66 
72  virtual const std::string& getResponse() const { return m_response; }
73 
77  virtual void clear();
78 
82  virtual void abort();
83 
87  virtual void getKwlTemplate(ossimKeywordlist& kwl);
88 
92  void getAPI(std::string& out) const;
93  std::string getAPI() const;
94 
95  virtual ossimString getClassName() const;
96 
101  void getBuildDate(std::string& s) const;
102 
107  void getRevision(std::string& s) const;
108 
113  void getVersion(std::string& s) const;
114 
115  // NOTE: The ossimToolFactory::getCapabilities() needs to access a brief description of each
116  // utility. For convenience, the ossimTool-derived (final) classes should declare a public
117  // static member to hold the description string. See ossimViewshedTool for an example.
118  // static const char* DESCRIPTION;
119 
123  virtual bool isChipProcessor() const { return false; }
124 
128  void setOutputStream(std::ostream* os) { m_consoleStream = os; }
129 
134  bool helpRequested() const { return m_helpRequested; }
135 
136 protected:
146  virtual void setUsage(ossimArgumentParser& ap);
147 
151  std::string m_response;
152 
153 private:
157  bool readTextFile(const ossimFilename& filename, std::string& contents) const;
158 
159 };
160 
161 #endif
std::string m_response
Definition: ossimTool.h:151
virtual void saveJSON(Json::Value &json) const
Fetch product as JSON object when applicable Always returns true since using exception on error...
Definition: ossimTool.h:59
Represents serializable keyword/value map.
bool m_helpRequested
Definition: ossimTool.h:150
virtual void loadJSON(const Json::Value &json_request)
Reads processing params from JSON object provided.
Definition: ossimTool.h:52
virtual bool isChipProcessor() const
Overrides base class implementation to indicate this class supports getChip() calls.
Definition: ossimTool.h:123
ossimKeywordlist m_kwl
Definition: ossimTool.h:148
void setOutputStream(std::ostream *os)
Redirects any console output to the supplied stream for logging or JNI application.
Definition: ossimTool.h:128
virtual const std::string & getResponse() const
Fetch product as string (typically JSON) when applicable, otherwise passes back empty string...
Definition: ossimTool.h:72
std::ostream * m_consoleStream
Definition: ossimTool.h:149
bool helpRequested() const
Returns true when the initialization detects a "--help" option, so caller can avoid subsequent execut...
Definition: ossimTool.h:134
Pure virtual interface for classes implementing JSON-based load/save state.
Definition: JsonInterface.h:19
#define OSSIM_DLL
const char * getClassName(int idx)
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23