mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
VectorVal methods to leverage ZVal representation
This commit is contained in:
parent
e80ab06775
commit
1f15f53f4b
1 changed files with 9 additions and 0 deletions
|
@ -1552,6 +1552,11 @@ public:
|
||||||
|
|
||||||
ValPtr ValAt(unsigned int index) const { return At(index); }
|
ValPtr ValAt(unsigned int index) const { return At(index); }
|
||||||
|
|
||||||
|
bool Has(unsigned int index) const
|
||||||
|
// Version to use once std::optional implementation is merged.
|
||||||
|
// { return index < vector_val->size() && vector_val[index]; }
|
||||||
|
{ return At(index) != nullptr; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the given element in a given underlying representation.
|
* Returns the given element in a given underlying representation.
|
||||||
* Enables efficient vector access. Caller must ensure that the
|
* Enables efficient vector access. Caller must ensure that the
|
||||||
|
@ -1560,8 +1565,12 @@ public:
|
||||||
* @param index The position in the vector of the element to return.
|
* @param index The position in the vector of the element to return.
|
||||||
* @return The element's underlying value.
|
* @return The element's underlying value.
|
||||||
*/
|
*/
|
||||||
|
bro_int_t IntAt(unsigned int index) const
|
||||||
|
{ return (*vector_val)[index]->int_val; }
|
||||||
bro_uint_t CountAt(unsigned int index) const
|
bro_uint_t CountAt(unsigned int index) const
|
||||||
{ return (*vector_val)[index]->uint_val; }
|
{ return (*vector_val)[index]->uint_val; }
|
||||||
|
double DoubleAt(unsigned int index) const
|
||||||
|
{ return (*vector_val)[index]->double_val; }
|
||||||
const RecordVal* RecordValAt(unsigned int index) const
|
const RecordVal* RecordValAt(unsigned int index) const
|
||||||
{ return (*vector_val)[index]->record_val; }
|
{ return (*vector_val)[index]->record_val; }
|
||||||
bool BoolAt(unsigned int index) const
|
bool BoolAt(unsigned int index) const
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue