14 #ifndef ARB_STRARRAY_H
20 #ifndef _GLIBCXX_STRING
26 #ifndef _GLIBCXX_VECTOR
30 #define sai_assert(cond) arb_assert(cond)
47 #define SAI_OPERATOR_TYPES 4
69 static const char *typeName[];
96 memset(transtab+1, default_translation, 255);
104 void addTranslation(const
char *from,
char to);
109 static const char DEFAULT_INDEX_CHAR =
'A';
111 std::vector<SaiOperatorPtr> secondToResult;
113 SaiMatrixTranslator() : SaiOperator(
SOP_MATRIX) {}
118 firstToIndexChar(new SaiTranslator(DEFAULT_INDEX_CHAR))
120 secondToResult.push_back(Default);
146 bool specifyTrueChars;
149 bool charSpecified(
char c)
const {
return chars.find_first_of(c) != std::string::npos; }
154 specifyTrueChars(specifyTrueChars_),
163 for (
size_t p = 0; p<len; ++p) {
164 output[p] = charSpecified(input[p]) == specifyTrueChars ?
'1' :
'0';
170 void apply(
char *inout,
const char *in,
size_t len)
const;
172 static ErrorOrSaiBoolRulePtr make(
const char *fromString);
178 std::vector<SaiBoolRule> rule;
199 #if defined(UNIT_TESTS)
200 void dropRule() { rule.pop_back(); }
226 const
std::
string get_aci()
const {
return aci; }
231 #error saiop.h included twice
static const char * type_name(SaiOperatorType type)
virtual ErrorOrString apply(const SaiCalcEnv &calcEnv) const =0
return string(buffer, length)
SaiMatrixTranslator(SaiOperatorPtr Default)
std::string get_description() const
ErrorOr< std::string > ErrorOrString
virtual std::string get_config() const =0
char getOutTrans(bool i) const
GB_ERROR check_lengths_equal(size_t &len) const
SaiCalcEnv(const CharPtrArray &input_, GBDATA *gb_main_)
static ErrorOrSaiOperatorPtr make(SaiOperatorType type, const char *config)
const SaiBoolRule & getRule(size_t idx) const
const CharPtrArray & get_input() const
size_t count_rules() const
void prepare_input_data(const char *input, size_t len, char *output) const
SaiOperatorType get_type() const
GBDATA * get_gbmain() const
SaiAciApplicator(const char *aci_)
SaiBoolchainOperator(char c_0, char c_1)
const char * get_chars() const
SmartPtr< SaiOperator > SaiOperatorPtr
SmartPtr< class SaiBoolRule > SaiBoolRulePtr
SaiBoolRule(SaiBoolOp op_, bool specifyTrueChars_, const char *chars_)
bool specifiesTrueChars() const
SaiOperator(SaiOperatorType type_)
ErrorOr< SaiOperatorPtr > ErrorOrSaiOperatorPtr
ErrorOr< SaiBoolRulePtr > ErrorOrSaiBoolRulePtr
SaiTranslator(char default_translation)