libTriton  version 0.9 build 1502
operandWrapper.hpp
Go to the documentation of this file.
1 /*
3 ** Copyright (C) - Triton
4 **
5 ** This program is under the terms of the Apache License 2.0.
6 */
7 
8 #ifndef TRITON_OPERANDWRAPPER_HPP
9 #define TRITON_OPERANDWRAPPER_HPP
10 
11 #include <triton/archEnums.hpp>
12 #include <triton/dllexport.hpp>
13 #include <triton/immediate.hpp>
14 #include <triton/memoryAccess.hpp>
15 #include <triton/register.hpp>
16 #include <triton/tritonTypes.hpp>
17 
18 
19 
21 namespace triton {
28  namespace arch {
39  private:
42 
45 
48 
51 
52  public:
54  TRITON_EXPORT OperandWrapper(const triton::arch::Immediate& imm);
55 
57  TRITON_EXPORT OperandWrapper(const triton::arch::MemoryAccess& mem);
58 
60  TRITON_EXPORT OperandWrapper(const triton::arch::Register& reg);
61 
63  TRITON_EXPORT OperandWrapper(const OperandWrapper& other);
64 
66  TRITON_EXPORT triton::arch::operand_e getType(void) const;
67 
69  TRITON_EXPORT triton::arch::Immediate& getImmediate(void);
70 
72  TRITON_EXPORT triton::arch::MemoryAccess& getMemory(void);
73 
75  TRITON_EXPORT triton::arch::Register& getRegister(void);
76 
78  TRITON_EXPORT const triton::arch::Immediate& getConstImmediate(void) const;
79 
81  TRITON_EXPORT const triton::arch::MemoryAccess& getConstMemory(void) const;
82 
84  TRITON_EXPORT const triton::arch::Register& getConstRegister(void) const;
85 
87  TRITON_EXPORT void setImmediate(const triton::arch::Immediate& imm);
88 
90  TRITON_EXPORT void setMemory(const triton::arch::MemoryAccess& mem);
91 
93  TRITON_EXPORT void setRegister(const triton::arch::Register& reg);
94 
96  TRITON_EXPORT triton::uint32 getSize(void) const;
97 
99  TRITON_EXPORT triton::uint32 getBitSize(void) const;
100 
102  TRITON_EXPORT triton::uint32 getHigh(void) const;
103 
105  TRITON_EXPORT triton::uint32 getLow(void) const;
106 
108  TRITON_EXPORT OperandWrapper& operator=(const OperandWrapper& other);
109 
111  TRITON_EXPORT bool operator==(const OperandWrapper& other) const;
112 
114  TRITON_EXPORT bool operator!=(const OperandWrapper& other) const;
115 
117  TRITON_EXPORT bool operator<(const OperandWrapper& other) const;
118  };
119 
121  TRITON_EXPORT std::ostream& operator<<(std::ostream& stream, const triton::arch::OperandWrapper& op);
122 
124  TRITON_EXPORT std::ostream& operator<<(std::ostream& stream, const triton::arch::OperandWrapper* op);
125 
127  };
129 };
130 
131 #endif /* TRITON_OPERANDWRAPPER_HPP */
This class is used to represent an immediate.
Definition: immediate.hpp:37
This class is used to represent a memory access.
This class is used as operand wrapper.
TRITON_EXPORT bool operator==(const OperandWrapper &other) const
Tests two OperandWrappers for equality.
TRITON_EXPORT OperandWrapper(const triton::arch::Immediate &imm)
Immediate constructor.
TRITON_EXPORT bool operator<(const OperandWrapper &other) const
Compares two OperandWrappers for ordering.
TRITON_EXPORT bool operator!=(const OperandWrapper &other) const
Tests two OperandWrappers for not equality.
TRITON_EXPORT triton::arch::Register & getRegister(void)
Returns the register operand.
TRITON_EXPORT void setRegister(const triton::arch::Register &reg)
Sets the register operand.
TRITON_EXPORT triton::uint32 getLow(void) const
Returns the lower bit position of the abstract operand.
TRITON_EXPORT triton::arch::operand_e getType(void) const
Returns the abstract type of the operand.
TRITON_EXPORT void setImmediate(const triton::arch::Immediate &imm)
Sets the immediate operand.
TRITON_EXPORT triton::uint32 getSize(void) const
Returns the abstract size (in bytes) of the operand.
TRITON_EXPORT const triton::arch::MemoryAccess & getConstMemory(void) const
Returns the memory operand as const.
TRITON_EXPORT triton::arch::MemoryAccess & getMemory(void)
Returns the memory operand.
TRITON_EXPORT void setMemory(const triton::arch::MemoryAccess &mem)
Sets the memory operand.
TRITON_EXPORT const triton::arch::Register & getConstRegister(void) const
Returns the register operand.
TRITON_EXPORT triton::uint32 getHigh(void) const
Returns the highest bit position of the abstract operand.
TRITON_EXPORT const triton::arch::Immediate & getConstImmediate(void) const
Returns the immediate operand.
TRITON_EXPORT triton::uint32 getBitSize(void) const
Returns the abstract size (in bits) of the operand.
TRITON_EXPORT OperandWrapper & operator=(const OperandWrapper &other)
Copies a OperandWrapper.
TRITON_EXPORT triton::arch::Immediate & getImmediate(void)
Returns the immediate operand.
This class is used when an instruction has a register operand.
Definition: register.hpp:44
std::ostream & operator<<(std::ostream &stream, const BitsVector &bv)
Displays a BitsVector.
Definition: bitsVector.cpp:103
std::uint32_t uint32
unisgned 32-bits
Definition: tritonTypes.hpp:31
The Triton namespace.
Definition: api.cpp:227