P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::P4Tools::P4Testgen::Bmv2::IndexMap Class Reference

Readable and writable symbolic map, which maps indices to particular values. More...

#include <test_spec.h>

Inheritance diagram for P4::P4Tools::P4Testgen::Bmv2::IndexMap:
[legend]

Public Member Functions

 IndexMap (const IR::Expression *initialValue)
 
 DECLARE_TYPEINFO (IndexMap, TestObject)
 
const IR::Constant * getEvaluatedInitialValue () const
 
const IR::Expression * getInitialValue () const
 
const IR::Expression * getValueAtIndex (const IR::Expression *index) const
 
std::map< big_int, std::pair< int, const IR::Constant * > > unravelMap () const
 Return the "writes" to this index map as a.
 
void writeToIndex (const IR::Expression *index, const IR::Expression *value)
 Write.
 
- Public Member Functions inherited from P4::P4Tools::P4Testgen::TestObject
 TestObject (const TestObject &)=default
 
 TestObject (TestObject &&)=default
 
 DECLARE_TYPEINFO (TestObject)
 
virtual const TestObjectevaluate (const Model &model, bool doComplete) const =0
 
virtual cstring getObjectName () const =0
 
TestObjectoperator= (const TestObject &)=default
 
TestObjectoperator= (TestObject &&)=default
 
- Public Member Functions inherited from P4::ICastable
template<typename T >
T & as ()
 Tries to convert the class to type T. A BUG occurs if the cast fails.
 
template<typename T >
const T & as () const
 Tries to convert the class to type T. A BUG occurs if the cast fails.
 
template<typename T >
T * checkedTo ()
 Performs a checked cast. A BUG occurs if the cast fails.
 
template<typename T >
const T * checkedTo () const
 Performs a checked cast. A BUG occurs if the cast fails.
 
- Public Member Functions inherited from P4::RTTI::Base
template<typename T >
bool is () const noexcept
 
virtual bool isA (TypeId typeId) const noexcept=0
 
template<typename T >
const T * to () const noexcept
 Same as to, but returns const pointer to T.
 
template<typename T >
T * to () noexcept
 
virtual TypeId typeId () const noexcept=0
 

Protected Attributes

std::vector< IndexExpressionindexConditions
 Each element is an API name paired with a match rule.
 
const IR::Expression * initialValue
 A new IndexMap always requires an initial value. This can be a constant or taint.
 

Additional Inherited Members

- Protected Member Functions inherited from P4::RTTI::Base
virtual const void * toImpl (TypeId typeId) const noexcept=0
 

Detailed Description

Readable and writable symbolic map, which maps indices to particular values.

Member Function Documentation

◆ getEvaluatedInitialValue()

const IR::Constant * P4::P4Tools::P4Testgen::Bmv2::IndexMap::getEvaluatedInitialValue ( ) const
nodiscard
Returns
the evaluated register value. This means it must be a constant. The function will throw a bug if this is not the case.

◆ getInitialValue()

const IR::Expression * P4::P4Tools::P4Testgen::Bmv2::IndexMap::getInitialValue ( ) const
nodiscard
Returns
the value with which this register has been initialized.

◆ getValueAtIndex()

const IR::Expression * P4::P4Tools::P4Testgen::Bmv2::IndexMap::getValueAtIndex ( const IR::Expression * index) const
nodiscard
Returns
the current value of this register after writes have been performed according to a provided index.

◆ writeToIndex()

void P4::P4Tools::P4Testgen::Bmv2::IndexMap::writeToIndex ( const IR::Expression * index,
const IR::Expression * value )

Write.

Parameters
valueto
index.