Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Concepts
ResultInterpret.h
Go to the documentation of this file.
1
6#pragma once
7
10#include <memory>
11
12namespace cli {
13
15public:
16 static int cli ( const std::shared_ptr < abstraction::Value > & result ) {
17 if ( result ) {
18 std::shared_ptr < abstraction::ValueHolderInterface < int > > ptr1 = std::dynamic_pointer_cast < abstraction::ValueHolderInterface < int > > ( result );
19 if ( ptr1 )
20 return ptr1->getValue ( );
21 std::shared_ptr < abstraction::ValueHolderInterface < unsigned > > ptr2 = std::dynamic_pointer_cast < abstraction::ValueHolderInterface < unsigned > > ( result );
22 if ( ptr2 )
23 return static_cast < int > ( ptr2->getValue ( ) );
24 std::shared_ptr < abstraction::ValueHolderInterface < bool > > ptr3 = std::dynamic_pointer_cast < abstraction::ValueHolderInterface < bool > > ( result );
25 if ( ptr3 )
26 return static_cast < int > ( ! ptr3->getValue ( ) );
27
28 throw exception::CommonException ( "Invalid result type. Provided: " + result->getType ( ) );
29 } else {
30 return 0;
31 }
32 }
33};
34
35} /* namespace cli */
36
Definition: ResultInterpret.h:14
static int cli(const std::shared_ptr< abstraction::Value > &result)
Definition: ResultInterpret.h:16
Basic exception from which all other exceptions are derived.
Definition: CommonException.h:21
for(const StateType &state :fsm.getStates()) renamingData.insert(std Rename::RenamedAutomaton< T > result(renamingData.at(fsm.getInitialState()))
Definition: Rename.h:253
Definition: Arg.h:11