23 #ifndef INCLUDED_PMT_H 24 #define INCLUDED_PMT_H 28 #include <boost/any.hpp> 29 #include <boost/noncopyable.hpp> 30 #include <boost/shared_ptr.hpp> 63 virtual bool is_bool()
const {
return false; }
68 virtual bool is_real()
const {
return false; }
70 virtual bool is_null()
const {
return false; }
71 virtual bool is_pair()
const {
return false; }
72 virtual bool is_tuple()
const {
return false; }
74 virtual bool is_dict()
const {
return false; }
75 virtual bool is_any()
const {
return false; }
96 typedef boost::shared_ptr<pmt_base>
pmt_t;
101 exception(
const std::string& msg, pmt_t obj);
107 wrong_type(
const std::string& msg, pmt_t obj);
134 #define PMT_NIL get_PMT_NIL() 135 #define PMT_T get_PMT_T() 136 #define PMT_F get_PMT_F() 137 #define PMT_EOF get_PMT_EOF() 316 PMT_API pmt_t
cons(
const pmt_t& x,
const pmt_t& y);
359 const pmt_t& e0,
const pmt_t& e1,
const pmt_t& e2,
const pmt_t& e3,
const pmt_t& e4);
592 PMT_API const std::complex<double>*
664 PMT_API pmt_t
dict_add(
const pmt_t& dict,
const pmt_t& key,
const pmt_t& value);
673 PMT_API pmt_t
dict_ref(
const pmt_t& dict,
const pmt_t& key,
const pmt_t& not_found);
730 PMT_API bool eq(
const pmt_t& x,
const pmt_t& y);
746 PMT_API bool eqv(
const pmt_t& x,
const pmt_t& y);
797 PMT_API pmt_t
map(pmt_t proc(
const pmt_t&), pmt_t list);
816 inline static pmt_t
acons(pmt_t x, pmt_t y, pmt_t a) {
return cons(
cons(x, y), a); }
869 PMT_API pmt_t
list3(
const pmt_t& x1,
const pmt_t& x2,
const pmt_t& x3);
874 PMT_API pmt_t
list4(
const pmt_t& x1,
const pmt_t& x2,
const pmt_t& x3,
const pmt_t& x4);
880 const pmt_t& x1,
const pmt_t& x2,
const pmt_t& x3,
const pmt_t& x4,
const pmt_t& x5);
991 return pmt::eqv(p1, p2) ? false : p1.get() > p2.get();
1001 return pmt::eqv(p1, p2) ? false : p1.get() > p2.get();
virtual bool is_s64vector() const
Definition: pmt.h:85
PMT_API pmt_t cdr(const pmt_t &pair)
If pair is a pair, return the cdr of the pair, otherwise raise wrong_type.
virtual bool is_any() const
Definition: pmt.h:75
PMT_API pmt_t vector_ref(pmt_t vector, size_t k)
Provide a comparator function object to allow pmt use in stl types.
Definition: pmt.h:986
PMT_API pmt_t tuple_ref(const pmt_t &tuple, size_t k)
virtual bool is_bool() const
Definition: pmt.h:63
PMT_API pmt_t reverse(pmt_t list)
reverse list.
PMT_API pmt_t nthcdr(size_t n, pmt_t list)
returns the tail of list that would be obtained by calling cdr n times in succession.
PMT_API pmt_t list1(const pmt_t &x1)
Return a list of length 1 containing x1.
PMT_API bool is_uniform_vector(pmt_t x)
true if x is any kind of uniform numeric vector
virtual bool is_f64vector() const
Definition: pmt.h:87
PMT_API uint16_t u16vector_ref(pmt_t v, size_t k)
PMT_API bool is_u64vector(pmt_t x)
virtual bool is_symbol() const
Definition: pmt.h:64
PMT_API bool eqv(const pmt_t &x, const pmt_t &y)
Return true if x and y should normally be regarded as the same object, else false.
PMT_API float * f32vector_writable_elements(pmt_t v, size_t &len)
PMT_API void u8vector_set(pmt_t v, size_t k, uint8_t x)
PMT_API bool subsetp(pmt_t list1, pmt_t list2)
Return true if every element of list1 appears in list2, and false otherwise. Comparisons are done wit...
PMT_API pmt_t car(const pmt_t &pair)
If pair is a pair, return the car of the pair, otherwise raise wrong_type.
PMT_API std::complex< double > to_complex(pmt_t z)
PMT_API pmt_t read(std::istream &port)
PMT_API pmt_t make_u8vector(size_t k, uint8_t fill)
PMT_API bool is_f32vector(pmt_t x)
PMT_API bool list_has(pmt_t list, const pmt_t &item)
Return bool of list contains item.
virtual bool is_u32vector() const
Definition: pmt.h:82
PMT_API pmt_t from_long(long x)
Return the pmt value that represents the integer x.
boost::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting). See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
Definition: pmt.h:96
PMT_API void c32vector_set(pmt_t v, size_t k, std::complex< float > x)
PMT_API pmt_t caar(pmt_t pair)
virtual bool is_uniform_vector() const
Definition: pmt.h:77
PMT_API const std::vector< std::complex< float > > c32vector_elements(pmt_t v)
PMT_API const std::vector< float > f32vector_elements(pmt_t v)
PMT_API const std::vector< uint32_t > u32vector_elements(pmt_t v)
PMT_API bool is_f64vector(pmt_t x)
PMT_API pmt_t assv(pmt_t obj, pmt_t alist)
Find the first pair in alist whose car field is obj and return that pair.
PMT_API void u64vector_set(pmt_t v, size_t k, uint64_t x)
PMT_API bool is_u8vector(pmt_t x)
PMT_API pmt_t make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8, const pmt_t &e9)
PMT_API pmt_t init_f32vector(size_t k, const std::vector< float > &data)
PMT_API bool is_any(pmt_t obj)
Return true if obj is an any.
PMT_API pmt_t init_u16vector(size_t k, const std::vector< uint16_t > &data)
PMT_API const std::vector< std::complex< double > > pmt_c64vector_elements(pmt_t v)
PMT_API pmt_t init_c64vector(size_t k, const std::vector< std::complex< double >> &data)
virtual bool is_f32vector() const
Definition: pmt.h:86
PMT_API pmt_t list3(const pmt_t &x1, const pmt_t &x2, const pmt_t &x3)
Return a list of length 3 containing x1, x2, x3.
PMT_API void s8vector_set(pmt_t v, size_t k, int8_t x)
PMT_API uint8_t * u8vector_writable_elements(pmt_t v, size_t &len)
PMT_API pmt_t cddr(pmt_t pair)
virtual bool is_complex() const
Definition: pmt.h:69
PMT_API pmt_t dict_update(const pmt_t &dict1, const pmt_t &dict2)
Return a new dictionary dict1 with k=>v pairs from dict2 added.
PMT_API pmt_t init_s16vector(size_t k, const std::vector< int16_t > &data)
PMT_API pmt_t init_s8vector(size_t k, const std::vector< int8_t > &data)
PMT_API pmt_t from_float(float x)
PMT_API pmt_t memq(pmt_t obj, pmt_t list)
Return the first sublist of list whose car is obj. If obj does not occur in list, then #f is returned...
virtual bool is_u16vector() const
Definition: pmt.h:80
PMT_API uint64_t u64vector_ref(pmt_t v, size_t k)
PMT_API void set_cdr(pmt_t pair, pmt_t value)
Stores value in the cdr field of pair.
PMT_API const std::vector< uint64_t > pmt_u64vector_elements(pmt_t v)
PMT_API pmt_t dict_ref(const pmt_t &dict, const pmt_t &key, const pmt_t ¬_found)
If key exists in dict, return associated value; otherwise return not_found.
PMT_API pmt_t make_u64vector(size_t k, uint64_t fill)
PMT_API bool is_dict(const pmt_t &obj)
Return true if obj is a dictionary (warning: also returns true for a pair)
PMT_API int8_t * s8vector_writable_elements(pmt_t v, size_t &len)
PMT_API void u16vector_set(pmt_t v, size_t k, uint16_t x)
PMT_API pmt_t cadddr(pmt_t pair)
PMT_API void s64vector_set(pmt_t v, size_t k, int64_t x)
PMT_API pmt_t get_PMT_NIL()
virtual bool is_c32vector() const
Definition: pmt.h:88
PMT_API pmt_t list6(const pmt_t &x1, const pmt_t &x2, const pmt_t &x3, const pmt_t &x4, const pmt_t &x5, const pmt_t &x6)
Return a list of length 6 containing x1, x2, x3, x4, x5, x6.
pmt_base()
Definition: pmt.h:60
PMT_API const std::vector< uint8_t > u8vector_elements(pmt_t v)
PMT_API int32_t * s32vector_writable_elements(pmt_t v, size_t &len)
PMT_API void vector_set(pmt_t vector, size_t k, pmt_t obj)
Store obj in position k.
PMT_API std::complex< double > * c64vector_writable_elements(pmt_t v, size_t &len)
virtual bool is_tuple() const
Definition: pmt.h:72
PMT_API pmt_t member(pmt_t obj, pmt_t list)
Return the first sublist of list whose car is obj. If obj does not occur in list, then #f is returned...
PMT_API bool is_symbol(const pmt_t &obj)
Return true if obj is a symbol, else false.
PMT_API uint32_t * u32vector_writable_elements(pmt_t v, size_t &len)
PMT_API int64_t * s64vector_writable_elements(pmt_t v, size_t &len)
PMT_API const std::vector< int16_t > pmt_s16vector_elements(pmt_t v)
PMT_API pmt_t dict_delete(const pmt_t &dict, const pmt_t &key)
Return a new dictionary with key removed.
PMT_API pmt_t make_s32vector(size_t k, int32_t fill)
PMT_API uint64_t * u64vector_writable_elements(pmt_t v, size_t &len)
PMT_API pmt_t init_u32vector(size_t k, const std::vector< uint32_t > &data)
PMT_API const std::vector< uint16_t > pmt_u16vector_elements(pmt_t v)
PMT_API pmt_t intern(const std::string &s)
Alias for pmt_string_to_symbol.
PMT_API bool eq(const pmt_t &x, const pmt_t &y)
Return true if x and y are the same object; otherwise return false.
PMT_API std::string serialize_str(pmt_t obj)
Provide a simple string generating interface to pmt's serialize function.
PMT_API pmt_t make_f64vector(size_t k, double fill)
PMT_API const std::string symbol_to_string(const pmt_t &sym)
Definition: cc_common.h:45
PMT_API pmt_t init_s64vector(size_t k, const std::vector< int64_t > &data)
PMT_API int8_t s8vector_ref(pmt_t v, size_t k)
PMT_API pmt_t make_dict()
Make an empty dictionary.
PMT_API bool is_s32vector(pmt_t x)
PMT_API const void * uniform_vector_elements(pmt_t v, size_t &len)
PMT_API double * f64vector_writable_elements(pmt_t v, size_t &len)
PMT_API bool to_bool(pmt_t val)
Return true if val is pmt::True, return false when val is pmt::PMT_F,.
virtual bool is_s32vector() const
Definition: pmt.h:83
PMT_API pmt_t init_f64vector(size_t k, const std::vector< double > &data)
PMT_API pmt_t dict_add(const pmt_t &dict, const pmt_t &key, const pmt_t &value)
Return a new dictionary with key associated with value.
PMT_API bool serialize(pmt_t obj, std::streambuf &sink)
Write portable byte-serial representation of obj to sink.
PMT_API const std::vector< int64_t > pmt_s64vector_elements(pmt_t v)
PMT_API pmt_t string_to_symbol(const std::string &s)
Return the symbol whose name is s.
PMT_API bool is_eof_object(pmt_t obj)
return true if obj is the EOF object, otherwise return false.
PMT_API pmt_t make_vector(size_t k, pmt_t fill)
Make a vector of length k, with initial values set to fill.
PMT_API uint8_t u8vector_ref(pmt_t v, size_t k)
PMT_API size_t blob_length(pmt_t blob)
Return the blob's length in bytes.
virtual bool is_null() const
Definition: pmt.h:70
PMT_API void s32vector_set(pmt_t v, size_t k, int32_t x)
bool operator()(pmt::pmt_t const &p1, pmt::pmt_t const &p2) const
Definition: pmt.h:999
PMT_API pmt_t dict_keys(pmt_t dict)
Return list of keys.
PMT_API void f64vector_set(pmt_t v, size_t k, double x)
PMT_API void set_car(pmt_t pair, pmt_t value)
Stores value in the car field of pair.
PMT_API const std::vector< double > f64vector_elements(pmt_t v)
PMT_API pmt_t list5(const pmt_t &x1, const pmt_t &x2, const pmt_t &x3, const pmt_t &x4, const pmt_t &x5)
Return a list of length 5 containing x1, x2, x3, x4, x5.
virtual bool is_uint64() const
Definition: pmt.h:67
PMT_API pmt_t from_uint64(uint64_t x)
Return the pmt value that represents the uint64 x.
PMT_API bool is_false(pmt_t obj)
Return true if obj is #f, else return true.
PMT_API pmt_t pmt_from_complex(const std::complex< double > &z)
Return a complex number constructed of the given a complex number.
PMT_API pmt_t reverse_x(pmt_t list)
destructively reverse list.
PMT_API pmt_t get_PMT_T()
PMT_API std::complex< float > c32vector_ref(pmt_t v, size_t k)
PMT_API uint64_t to_uint64(pmt_t x)
Convert pmt to uint64 if possible.
PMT_API pmt_t init_s32vector(size_t k, const std::vector< int32_t > &data)
PMT_API bool is_integer(pmt_t x)
Return true if x is an integer number, else false.
PMT_API void u32vector_set(pmt_t v, size_t k, uint32_t x)
PMT_API pmt_t get_PMT_F()
PMT_API const std::vector< int32_t > s32vector_elements(pmt_t v)
PMT_API float f32vector_ref(pmt_t v, size_t k)
virtual bool is_u64vector() const
Definition: pmt.h:84
virtual bool is_pair() const
Definition: pmt.h:71
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:43
PMT_API void any_set(pmt_t obj, const boost::any &any)
Store any in obj.
PMT_API uint16_t * u16vector_writable_elements(pmt_t v, size_t &len)
PMT_API bool equal(const pmt_t &x, const pmt_t &y)
PMT_API bool is_s64vector(pmt_t x)
PMT_API pmt_t make_c32vector(size_t k, std::complex< float > fill)
PMT_API const std::vector< int8_t > pmt_s8vector_elements(pmt_t v)
PMT_API int32_t s32vector_ref(pmt_t v, size_t k)
PMT_API long to_long(pmt_t x)
Convert pmt to long if possible.
PMT_API pmt_t make_s64vector(size_t k, int64_t fill)
virtual bool is_real() const
Definition: pmt.h:68
PMT_API void vector_fill(pmt_t vector, pmt_t fill)
Store fill in every position of vector.
PMT_API bool is_uint64(pmt_t x)
Return true if x is an uint64 number, else false.
PMT_API int64_t s64vector_ref(pmt_t v, size_t k)
PMT_API bool is_true(pmt_t obj)
Return false if obj is #f, else return true.
PMT_API double to_double(pmt_t x)
Convert pmt to double if possible.
PMT_API pmt_t map(pmt_t proc(const pmt_t &), pmt_t list)
Apply proc element-wise to the elements of list and returns a list of the results, in order.
PMT_API bool is_msg_accepter(const pmt_t &obj)
Return true if obj is a msg_accepter.
PMT_API size_t length(const pmt_t &v)
Return the number of elements in v.
PMT_API pmt_t cons(const pmt_t &x, const pmt_t &y)
Return a newly allocated pair whose car is x and whose cdr is y.
PMT_API pmt_t get_PMT_EOF()
PMT_API pmt_t deserialize(std::streambuf &source)
Create obj from portable byte-serial representation.
PMT_API float to_float(pmt_t x)
Convert pmt to float if possible.
PMT_API void f32vector_set(pmt_t v, size_t k, float x)
PMT_API pmt_t init_u64vector(size_t k, const std::vector< uint64_t > &data)
PMT_API pmt_t from_complex(const std::complex< double > &z)
Return a complex number constructed of the given a complex number.
PMT_API bool is_null(const pmt_t &x)
Return true if x is the empty list, otherwise return false.
bool operator()(pmt::pmt_t const &p1, pmt::pmt_t const &p2) const
Definition: pmt.h:989
PMT_API pmt_t list_rm(pmt_t list, const pmt_t &item)
Return list with item removed from it.
PMT_API pmt_t make_rectangular(double re, double im)
Return a complex number constructed of the given real and imaginary parts.
PMT_API pmt_t make_s8vector(size_t k, int8_t fill)
virtual bool is_dict() const
Definition: pmt.h:74
#define PMT_API
Definition: gnuradio-runtime/include/pmt/api.h:30
PMT_API pmt_t assq(pmt_t obj, pmt_t alist)
Find the first pair in alist whose car field is obj and return that pair.
base class of all pmt types
Definition: pmt.h:56
PMT_API void write(pmt_t obj, std::ostream &port)
PMT_API const std::vector< int64_t > s64vector_elements(pmt_t v)
PMT_API pmt_t make_blob(const void *buf, size_t len)
Make a blob given a pointer and length in bytes.
PMT_API void s16vector_set(pmt_t v, size_t k, int16_t x)
PMT_API bool is_bool(pmt_t obj)
Return true if obj is #t or #f, else return false.
PMT_API bool is_u16vector(pmt_t x)
PMT_API void dump_sizeof()
PMT_API const std::vector< std::complex< double > > c64vector_elements(pmt_t v)
PMT_API pmt_t make_any(const boost::any &any)
make an any
virtual bool is_s8vector() const
Definition: pmt.h:79
PMT_API pmt_t cadr(pmt_t pair)
PMT_API pmt_t list2(const pmt_t &x1, const pmt_t &x2)
Return a list of length 2 containing x1, x2.
PMT_API size_t uniform_vector_itemsize(pmt_t x)
item size in bytes if x is any kind of uniform numeric vector
PMT_API const std::vector< std::complex< float > > pmt_c32vector_elements(pmt_t v)
PMT_API bool is_c32vector(pmt_t x)
PMT_API pmt_t to_tuple(const pmt_t &x)
PMT_API pmt_t memv(pmt_t obj, pmt_t list)
Return the first sublist of list whose car is obj. If obj does not occur in list, then #f is returned...
PMT_API pmt_t list4(const pmt_t &x1, const pmt_t &x2, const pmt_t &x3, const pmt_t &x4)
Return a list of length 4 containing x1, x2, x3, x4.
PMT_API pmt_t dict_items(pmt_t dict)
Return list of (key . value) pairs.
PMT_API pmt_t cdar(pmt_t pair)
PMT_API pmt_t list_add(pmt_t list, const pmt_t &item)
Return list with item added to it.
PMT_API boost::any any_ref(pmt_t obj)
Return underlying boost::any.
std::ostream & operator<<(std::ostream &os, basic_block_sptr basic_block)
Definition: basic_block.h:416
PMT_API pmt_t deserialize_str(std::string str)
Provide a simple string generating interface to pmt's deserialize function.
PMT_API pmt_t make_u32vector(size_t k, uint32_t fill)
PMT_API pmt_t dict_values(pmt_t dict)
Return list of values.
virtual bool is_number() const
Definition: pmt.h:65
PMT_API pmt_t nth(size_t n, pmt_t list)
locates nth element of list where the car is the 'zeroth' element.
PMT_API const std::vector< int16_t > s16vector_elements(pmt_t v)
PMT_API bool is_blob(pmt_t x)
Return true if x is a blob, otherwise false.
PMT_API bool dict_has_key(const pmt_t &dict, const pmt_t &key)
Return true if key exists in dict.
PMT_API pmt_t caddr(pmt_t pair)
PMT_API void c64vector_set(pmt_t v, size_t k, std::complex< double > x)
PMT_API bool is_pair(const pmt_t &obj)
Return true if obj is a pair, else false (warning: also returns true for a dict)
PMT_API bool is_c64vector(pmt_t x)
PMT_API pmt_t assoc(pmt_t obj, pmt_t alist)
Find the first pair in alist whose car field is obj and return that pair.
PMT_API void * uniform_vector_writable_elements(pmt_t v, size_t &len)
PMT_API pmt_t from_bool(bool val)
Return #f is val is false, else return #t.
PMT_API pmt_t from_double(double x)
Return the pmt value that represents double x.
PMT_API pmt_t make_s16vector(size_t k, int16_t fill)
PMT_API const std::vector< double > pmt_f64vector_elements(pmt_t v)
PMT_API bool is_complex(pmt_t obj)
return true if obj is a complex number, false otherwise.
PMT_API bool is_s8vector(pmt_t x)
PMT_API const std::vector< uint32_t > pmt_u32vector_elements(pmt_t v)
PMT_API pmt_t init_u8vector(size_t k, const std::vector< uint8_t > &data)
PMT_API double f64vector_ref(pmt_t v, size_t k)
PMT_API pmt_t init_c32vector(size_t k, const std::vector< std::complex< float >> &data)
PMT_API boost::shared_ptr< gr::messages::msg_accepter > msg_accepter_ref(const pmt_t &obj)
Return underlying msg_accepter.
virtual bool is_s16vector() const
Definition: pmt.h:81
virtual bool is_integer() const
Definition: pmt.h:66
PMT_API bool is_u32vector(pmt_t x)
PMT_API std::complex< float > * c32vector_writable_elements(pmt_t v, size_t &len)
PMT_API void print(pmt_t v)
Write pmt string representation to stdout.
static pmt_t acons(pmt_t x, pmt_t y, pmt_t a)
(acons x y a) == (cons (cons x y) a)
Definition: pmt.h:816
PMT_API pmt_t make_msg_accepter(boost::shared_ptr< gr::messages::msg_accepter > ma)
make a msg_accepter
PMT_API bool is_real(pmt_t obj)
PMT_API const std::vector< int32_t > pmt_s32vector_elements(pmt_t v)
PMT_API pmt_t make_u16vector(size_t k, uint16_t fill)
PMT_API const std::vector< uint64_t > u64vector_elements(pmt_t v)
PMT_API bool is_number(pmt_t obj)
Return true if obj is any kind of number, else false.
PMT_API uint32_t u32vector_ref(pmt_t v, size_t k)
PMT_API std::complex< double > c64vector_ref(pmt_t v, size_t k)
PMT_API bool is_tuple(pmt_t x)
Return true if x is a tuple, otherwise false.
virtual bool is_c64vector() const
Definition: pmt.h:89
PMT_API const void * blob_data(pmt_t blob)
Return a pointer to the blob's data.
PMT_API bool is_vector(pmt_t x)
Return true if x is a vector, otherwise false.
PMT_API int16_t s16vector_ref(pmt_t v, size_t k)
virtual bool is_u8vector() const
Definition: pmt.h:78
PMT_API std::string write_string(pmt_t obj)
PMT_API int16_t * s16vector_writable_elements(pmt_t v, size_t &len)
PMT_API bool is_s16vector(pmt_t x)
PMT_API const std::vector< float > pmt_f32vector_elements(pmt_t v)
PMT_API const std::vector< int8_t > s8vector_elements(pmt_t v)
PMT_API const std::vector< uint8_t > pmt_u8vector_elements(pmt_t v)
PMT_API pmt_t make_f32vector(size_t k, float fill)
PMT_API pmt_t make_c64vector(size_t k, std::complex< double > fill)
PMT_API const std::vector< uint16_t > u16vector_elements(pmt_t v)
virtual bool is_vector() const
Definition: pmt.h:73