/usr/include/odindata/step.h is in libodin-dev 1.8.8-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | /***************************************************************************
step.h - description
-------------------
begin : Sat Dec 30 2006
copyright : (C) 2000-2014 by Thies Jochimsen
email : thies@jochimsen.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef STEP_H
#define STEP_H
#include <odindata/data.h>
/**
* @addtogroup odindata
* @{
*/
///////////////////////////////////////////////////////////////////////////////////
/**
* Base class for all steps (functors).
* The template argument is the type of the specialized, derived class.
*/
template<class T>
class Step {
public:
virtual ~Step() {}
/**
* Overload this function to return a unique label for the functor.
*/
virtual STD_string label() const = 0;
/**
* Overload this function to return a brief description of the functor.
*/
virtual STD_string description() const = 0;
/**
* Overload this function to allocate an empty object of the step.
*/
virtual T* allocate() const = 0;
/**
* Initialize the step, i.e. initiliaze its parameters and append them by 'append_arg'.
*/
virtual void init() = 0;
/**
* Clone this step (including its arguments).
*/
T* clone() const;
/**
* Overrides the arguments of the functor using a string with comma-separated argument values.
*/
void set_args(const STD_string& argstr);
/**
* Returns description of arguments as comma-separated list.
*/
STD_string args_description() const;
/**
* Returns the number of arguments.
*/
unsigned int numof_args() const {return args.numof_pars();}
/**
* Append arguments of the functor to parblock.
*/
void append_opts(JcampDxBlock& parblock);
protected:
/**
* Append step argument, to be used in init() of each step.
*/
void append_arg(JcampDxClass& arg, const STD_string& arglabel);
const char* c_label() const {if(!label_cache.size()) label_cache=label(); return label_cache.c_str();} // For Debug
private:
JcampDxBlock args;
mutable STD_string label_cache;
};
///////////////////////////////////////////////////////////////////////////////////
/**
* Factory for steps (functors).
* The template argument is the type of the step to be created by the factory.
*/
template<class T>
class StepFactory {
public:
/**
* Set up factory (creates template objects). Appends parameters of all steps to 'parblock'.
*/
StepFactory(JcampDxBlock* parblock=0);
~StepFactory();
/**
* Returns allocated step functor which matches given 'label'.
*/
T* create(const STD_string& label) const;
/**
* Returns documention 'code' for doxygen.
*/
STD_string manual() const;
/**
* Returns documention for command line.
*/
STD_string get_cmdline_usage(const STD_string& lineprefix) const;
private:
typedef STD_map<STD_string,T*> StepMap;
StepMap templates;
mutable STD_list<T*> garbage;
};
/** @}
*/
#endif
|