InterpreterExtension.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2007 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/More/General/Pulsar/InterpreterExtension.h
10 
11 #ifndef __Pulsar_Interpreter_Extension_h
12 #define __Pulsar_Interpreter_Extension_h
13 
14 #include "Pulsar/Interpreter.h"
15 
16 namespace Pulsar {
17 
18  class Interpreter::Extension : public CommandParser {
19 
20  public:
21 
22  enum Status { Good, Warn, Fail };
23 
25  Archive* get ()
26  { return interpreter->get(); }
27 
29  Archive* getmap (const std::string& name)
30  { return interpreter->getmap(name); }
31 
32  std::vector<std::string> setup (const std::string& text, bool expand = true)
33  { return interpreter->setup (text, expand); }
34 
36  template<typename T> T setup (const std::string& args)
37  { return interpreter->setup<T> (args); }
38 
40  template<typename T> T setup (const std::string& args, T default_value)
41  { return interpreter->setup<T> (args, default_value); }
42 
43  std::string response (Status s, const std::string& text = "")
44  { return interpreter->response ((Interpreter::Status)s, text); }
45 
46  std::string response (const Error& error)
47  { return interpreter->response (error); }
48 
50  { return interpreter->get_interface (); }
51 
52  protected:
53 
54  friend class Interpreter;
55 
58 
59  };
60 
61 }
62 
63 #endif
Interpreter()
default constructor
Definition: Interpreter.C:318
Archive * get()
get the current Archive
Definition: Interpreter.C:463
TextInterface::Parser * get_interface()
get the interface to the current archive
Definition: Interpreter.C:835
const ExtensionType * get() const
Template method searches for an Extension of the specified type.
std::vector< std::string > setup(const std::string &args, bool expand=true)
All methods should call this method to parse the arguments.
Definition: Interpreter.C:370
std::string response(Status status, const std::string &text="")
All methods should return via the response methods.
Definition: Interpreter.C:401
Archive * getmap(const std::string &name, bool throw_exception=true)
get the named Archive
Definition: Interpreter.C:492
Defines the PSRCHIVE library.
Definition: CalSource.h:17

Generated using doxygen 1.8.17