GNU Radio Manual and C++ API Reference 3.7.14.0
The Free & Open Software Radio Ecosystem
pmt.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2006,2009,2010,2013 Free Software Foundation, Inc.
4 *
5 * This file is part of GNU Radio
6 *
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
10 * any later version.
11 *
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
21 */
22
23#ifndef INCLUDED_PMT_H
24#define INCLUDED_PMT_H
25
26#include <pmt/api.h>
27#include <stdint.h>
28#include <boost/any.hpp>
29#include <boost/intrusive_ptr.hpp>
30#include <boost/shared_ptr.hpp>
31#include <complex>
32#include <iosfwd>
33#include <stdexcept>
34#include <string>
35#include <vector>
36
37namespace gr {
38namespace messages {
39class msg_accepter;
40}
41} // namespace gr
42
43/*!
44 * This file defines a polymorphic type and the operations on it.
45 *
46 * It draws heavily on the idea of scheme and lisp data types.
47 * The interface parallels that in Guile 1.8, with the notable
48 * exception that these objects are transparently reference counted.
49 */
50
51namespace pmt {
52
53/*!
54 * \brief base class of all pmt types
55 */
56class pmt_base;
57
58/*!
59 * \brief typedef for shared pointer (transparent reference counting).
60 * See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
61 */
62typedef boost::intrusive_ptr<pmt_base> pmt_t;
63
64extern PMT_API void intrusive_ptr_add_ref(pmt_base*);
65extern PMT_API void intrusive_ptr_release(pmt_base*);
66
67class PMT_API exception : public std::logic_error
68{
69public:
70 exception(const std::string& msg, pmt_t obj);
71};
72
74{
75public:
76 wrong_type(const std::string& msg, pmt_t obj);
77};
78
80{
81public:
82 out_of_range(const std::string& msg, pmt_t obj);
83};
84
86{
87public:
88 notimplemented(const std::string& msg, pmt_t obj);
89};
90
91
92/*
93 * ------------------------------------------------------------------------
94 * Constants
95 * ------------------------------------------------------------------------
96 */
97
102
103#define PMT_NIL get_PMT_NIL()
104#define PMT_T get_PMT_T()
105#define PMT_F get_PMT_F()
106#define PMT_EOF get_PMT_EOF()
107
108
109/*
110 * ------------------------------------------------------------------------
111 * Booleans. Two constants, #t and #f.
112 *
113 * In predicates, anything that is not #f is considered true.
114 * I.e., there is a single false value, #f.
115 * ------------------------------------------------------------------------
116 */
117
118//! Return true if obj is \#t or \#f, else return false.
120
121//! Return false if obj is \#f, else return true.
123
124//! Return true if obj is \#f, else return true.
126
127//! Return \#f is val is false, else return \#t.
129
130//! Return true if val is pmt::True, return false when val is pmt::PMT_F,
131// else raise wrong_type exception.
133
134/*
135 * ------------------------------------------------------------------------
136 * Symbols
137 * ------------------------------------------------------------------------
138 */
139
140//! Return true if obj is a symbol, else false.
141PMT_API bool is_symbol(const pmt_t& obj);
142
143//! Return the symbol whose name is \p s.
144PMT_API pmt_t string_to_symbol(const std::string& s);
145
146//! Alias for pmt_string_to_symbol
147PMT_API pmt_t intern(const std::string& s);
148
149
150/*!
151 * If \p is a symbol, return the name of the symbol as a string.
152 * Otherwise, raise the wrong_type exception.
153 */
154PMT_API const std::string symbol_to_string(const pmt_t& sym);
155
156/*
157 * ------------------------------------------------------------------------
158 * Numbers: we support integer, real and complex
159 * ------------------------------------------------------------------------
160 */
161
162//! Return true if obj is any kind of number, else false.
164
165/*
166 * ------------------------------------------------------------------------
167 * Integers
168 * ------------------------------------------------------------------------
169 */
170
171//! Return true if \p x is an integer number, else false
173
174//! Return the pmt value that represents the integer \p x.
176
177/*!
178 * \brief Convert pmt to long if possible.
179 *
180 * When \p x represents an exact integer that fits in a long,
181 * return that integer. Else raise an exception, either wrong_type
182 * when x is not an exact integer, or out_of_range when it doesn't fit.
183 */
185
186/*
187 * ------------------------------------------------------------------------
188 * uint64_t
189 * ------------------------------------------------------------------------
190 */
191
192//! Return true if \p x is an uint64 number, else false
194
195//! Return the pmt value that represents the uint64 \p x.
197
198/*!
199 * \brief Convert pmt to uint64 if possible.
200 *
201 * When \p x represents an exact integer that fits in a uint64,
202 * return that uint64. Else raise an exception, either wrong_type
203 * when x is not an exact uint64, or out_of_range when it doesn't fit.
204 */
206
207/*
208 * ------------------------------------------------------------------------
209 * Reals
210 * ------------------------------------------------------------------------
211 */
212
213/*
214 * \brief Return true if \p obj is a real number, else false.
215 */
217
218//! Return the pmt value that represents double \p x.
221
222/*!
223 * \brief Convert pmt to double if possible.
224 *
225 * Returns the number closest to \p val that is representable
226 * as a double. The argument \p val must be a real or integer, otherwise
227 * a wrong_type exception is raised.
228 */
230
231/*!
232 * \brief Convert pmt to float if possible.
233 *
234 * This basically is to_double() with a type-cast; the PMT stores
235 * the value as a double in any case. Use this when strict typing
236 * is required.
237 */
239
240/*
241 * ------------------------------------------------------------------------
242 * Complex
243 * ------------------------------------------------------------------------
244 */
245
246/*!
247 * \brief return true if \p obj is a complex number, false otherwise.
248 */
250
251//! Return a complex number constructed of the given real and imaginary parts.
252PMT_API pmt_t make_rectangular(double re, double im);
253
254//! Return a complex number constructed of the given real and imaginary parts.
255PMT_API pmt_t from_complex(double re, double im);
256
257//! Return a complex number constructed of the given a complex number.
258PMT_API pmt_t from_complex(const std::complex<double>& z);
259
260//! Return a complex number constructed of the given real and imaginary parts.
261PMT_API pmt_t pmt_from_complex(double re, double im);
262
263//! Return a complex number constructed of the given a complex number.
264PMT_API pmt_t pmt_from_complex(const std::complex<double>& z);
265
266/*!
267 * If \p z is complex, real or integer, return the closest complex<double>.
268 * Otherwise, raise the wrong_type exception.
269 */
270PMT_API std::complex<double> to_complex(pmt_t z);
271
272/*
273 * ------------------------------------------------------------------------
274 * Pairs
275 * ------------------------------------------------------------------------
276 */
277
278//! Return true if \p x is the empty list, otherwise return false.
279PMT_API bool is_null(const pmt_t& x);
280
281//! Return true if \p obj is a pair, else false (warning: also returns true for a dict)
282PMT_API bool is_pair(const pmt_t& obj);
283
284//! Return a newly allocated pair whose car is \p x and whose cdr is \p y.
285PMT_API pmt_t cons(const pmt_t& x, const pmt_t& y);
286
287//! If \p pair is a pair, return the car of the \p pair, otherwise raise wrong_type.
288PMT_API pmt_t car(const pmt_t& pair);
289
290//! If \p pair is a pair, return the cdr of the \p pair, otherwise raise wrong_type.
291PMT_API pmt_t cdr(const pmt_t& pair);
292
293//! Stores \p value in the car field of \p pair.
294PMT_API void set_car(pmt_t pair, pmt_t value);
295
296//! Stores \p value in the cdr field of \p pair.
297PMT_API void set_cdr(pmt_t pair, pmt_t value);
298
305
306/*
307 * ------------------------------------------------------------------------
308 * Tuples
309 *
310 * Store a fixed number of objects. Tuples are not modifiable, and thus
311 * are excellent for use as messages. Indexing is zero based.
312 * Access time to an element is O(1).
313 * ------------------------------------------------------------------------
314 */
315
316//! Return true if \p x is a tuple, otherwise false.
318
321PMT_API pmt_t make_tuple(const pmt_t& e0, const pmt_t& e1);
322PMT_API pmt_t make_tuple(const pmt_t& e0, const pmt_t& e1, const pmt_t& e2);
324 const pmt_t& e1,
325 const pmt_t& e2,
326 const pmt_t& e3);
328 const pmt_t& e0, const pmt_t& e1, const pmt_t& e2, const pmt_t& e3, const pmt_t& e4);
330 const pmt_t& e1,
331 const pmt_t& e2,
332 const pmt_t& e3,
333 const pmt_t& e4,
334 const pmt_t& e5);
336 const pmt_t& e1,
337 const pmt_t& e2,
338 const pmt_t& e3,
339 const pmt_t& e4,
340 const pmt_t& e5,
341 const pmt_t& e6);
343 const pmt_t& e1,
344 const pmt_t& e2,
345 const pmt_t& e3,
346 const pmt_t& e4,
347 const pmt_t& e5,
348 const pmt_t& e6,
349 const pmt_t& e7);
351 const pmt_t& e1,
352 const pmt_t& e2,
353 const pmt_t& e3,
354 const pmt_t& e4,
355 const pmt_t& e5,
356 const pmt_t& e6,
357 const pmt_t& e7,
358 const pmt_t& e8);
360 const pmt_t& e1,
361 const pmt_t& e2,
362 const pmt_t& e3,
363 const pmt_t& e4,
364 const pmt_t& e5,
365 const pmt_t& e6,
366 const pmt_t& e7,
367 const pmt_t& e8,
368 const pmt_t& e9);
369
370/*!
371 * If \p x is a vector or proper list, return a tuple containing the elements of x
372 */
374
375/*!
376 * Return the contents of position \p k of \p tuple.
377 * \p k must be a valid index of \p tuple.
378 */
379PMT_API pmt_t tuple_ref(const pmt_t& tuple, size_t k);
380
381/*
382 * ------------------------------------------------------------------------
383 * Vectors
384 *
385 * These vectors can hold any kind of objects. Indexing is zero based.
386 * ------------------------------------------------------------------------
387 */
388
389//! Return true if \p x is a vector, otherwise false.
391
392//! Make a vector of length \p k, with initial values set to \p fill
394
395/*!
396 * Return the contents of position \p k of \p vector.
397 * \p k must be a valid index of \p vector.
398 */
399PMT_API pmt_t vector_ref(pmt_t vector, size_t k);
400
401//! Store \p obj in position \p k.
402PMT_API void vector_set(pmt_t vector, size_t k, pmt_t obj);
403
404//! Store \p fill in every position of \p vector
405PMT_API void vector_fill(pmt_t vector, pmt_t fill);
406
407/*
408 * ------------------------------------------------------------------------
409 * Binary Large Objects (BLOBs)
410 *
411 * Handy for passing around uninterpreted chunks of memory.
412 * ------------------------------------------------------------------------
413 */
414
415//! Return true if \p x is a blob, otherwise false.
417
418/*!
419 * \brief Make a blob given a pointer and length in bytes
420 *
421 * \param buf is the pointer to data to use to create blob
422 * \param len is the size of the data in bytes.
423 *
424 * The data is copied into the blob.
425 */
426PMT_API pmt_t make_blob(const void* buf, size_t len);
427
428//! Return a pointer to the blob's data
429PMT_API const void* blob_data(pmt_t blob);
430
431//! Return the blob's length in bytes
433
434/*!
435 * <pre>
436 * Uniform Numeric Vectors
437 *
438 * A uniform numeric vector is a vector whose elements are all of single
439 * numeric type. pmt offers uniform numeric vectors for signed and
440 * unsigned 8-bit, 16-bit, 32-bit, and 64-bit integers, two sizes of
441 * floating point values, and complex floating-point numbers of these
442 * two sizes. Indexing is zero based.
443 *
444 * The names of the functions include these tags in their names:
445 *
446 * u8 unsigned 8-bit integers
447 * s8 signed 8-bit integers
448 * u16 unsigned 16-bit integers
449 * s16 signed 16-bit integers
450 * u32 unsigned 32-bit integers
451 * s32 signed 32-bit integers
452 * u64 unsigned 64-bit integers
453 * s64 signed 64-bit integers
454 * f32 the C++ type float
455 * f64 the C++ type double
456 * c32 the C++ type complex<float>
457 * c64 the C++ type complex<double>
458 * </pre>
459 */
460
461//! true if \p x is any kind of uniform numeric vector
463
476
477//! item size in bytes if \p x is any kind of uniform numeric vector
479
480PMT_API pmt_t make_u8vector(size_t k, uint8_t fill);
481PMT_API pmt_t make_s8vector(size_t k, int8_t fill);
482PMT_API pmt_t make_u16vector(size_t k, uint16_t fill);
483PMT_API pmt_t make_s16vector(size_t k, int16_t fill);
484PMT_API pmt_t make_u32vector(size_t k, uint32_t fill);
485PMT_API pmt_t make_s32vector(size_t k, int32_t fill);
486PMT_API pmt_t make_u64vector(size_t k, uint64_t fill);
487PMT_API pmt_t make_s64vector(size_t k, int64_t fill);
488PMT_API pmt_t make_f32vector(size_t k, float fill);
489PMT_API pmt_t make_f64vector(size_t k, double fill);
490PMT_API pmt_t make_c32vector(size_t k, std::complex<float> fill);
491PMT_API pmt_t make_c64vector(size_t k, std::complex<double> fill);
492
493PMT_API pmt_t init_u8vector(size_t k, const uint8_t* data);
494PMT_API pmt_t init_u8vector(size_t k, const std::vector<uint8_t>& data);
495PMT_API pmt_t init_s8vector(size_t k, const int8_t* data);
496PMT_API pmt_t init_s8vector(size_t k, const std::vector<int8_t>& data);
497PMT_API pmt_t init_u16vector(size_t k, const uint16_t* data);
498PMT_API pmt_t init_u16vector(size_t k, const std::vector<uint16_t>& data);
499PMT_API pmt_t init_s16vector(size_t k, const int16_t* data);
500PMT_API pmt_t init_s16vector(size_t k, const std::vector<int16_t>& data);
501PMT_API pmt_t init_u32vector(size_t k, const uint32_t* data);
502PMT_API pmt_t init_u32vector(size_t k, const std::vector<uint32_t>& data);
503PMT_API pmt_t init_s32vector(size_t k, const int32_t* data);
504PMT_API pmt_t init_s32vector(size_t k, const std::vector<int32_t>& data);
505PMT_API pmt_t init_u64vector(size_t k, const uint64_t* data);
506PMT_API pmt_t init_u64vector(size_t k, const std::vector<uint64_t>& data);
507PMT_API pmt_t init_s64vector(size_t k, const int64_t* data);
508PMT_API pmt_t init_s64vector(size_t k, const std::vector<int64_t>& data);
509PMT_API pmt_t init_f32vector(size_t k, const float* data);
510PMT_API pmt_t init_f32vector(size_t k, const std::vector<float>& data);
511PMT_API pmt_t init_f64vector(size_t k, const double* data);
512PMT_API pmt_t init_f64vector(size_t k, const std::vector<double>& data);
513PMT_API pmt_t init_c32vector(size_t k, const std::complex<float>* data);
514PMT_API pmt_t init_c32vector(size_t k, const std::vector<std::complex<float> >& data);
515PMT_API pmt_t init_c64vector(size_t k, const std::complex<double>* data);
516PMT_API pmt_t init_c64vector(size_t k, const std::vector<std::complex<double> >& data);
517
518PMT_API uint8_t u8vector_ref(pmt_t v, size_t k);
519PMT_API int8_t s8vector_ref(pmt_t v, size_t k);
520PMT_API uint16_t u16vector_ref(pmt_t v, size_t k);
521PMT_API int16_t s16vector_ref(pmt_t v, size_t k);
522PMT_API uint32_t u32vector_ref(pmt_t v, size_t k);
523PMT_API int32_t s32vector_ref(pmt_t v, size_t k);
524PMT_API uint64_t u64vector_ref(pmt_t v, size_t k);
525PMT_API int64_t s64vector_ref(pmt_t v, size_t k);
526PMT_API float f32vector_ref(pmt_t v, size_t k);
527PMT_API double f64vector_ref(pmt_t v, size_t k);
528PMT_API std::complex<float> c32vector_ref(pmt_t v, size_t k);
529PMT_API std::complex<double> c64vector_ref(pmt_t v, size_t k);
530
531PMT_API void u8vector_set(pmt_t v, size_t k, uint8_t x); //< v[k] = x
532PMT_API void s8vector_set(pmt_t v, size_t k, int8_t x);
533PMT_API void u16vector_set(pmt_t v, size_t k, uint16_t x);
534PMT_API void s16vector_set(pmt_t v, size_t k, int16_t x);
535PMT_API void u32vector_set(pmt_t v, size_t k, uint32_t x);
536PMT_API void s32vector_set(pmt_t v, size_t k, int32_t x);
537PMT_API void u64vector_set(pmt_t v, size_t k, uint64_t x);
538PMT_API void s64vector_set(pmt_t v, size_t k, int64_t x);
539PMT_API void f32vector_set(pmt_t v, size_t k, float x);
540PMT_API void f64vector_set(pmt_t v, size_t k, double x);
541PMT_API void c32vector_set(pmt_t v, size_t k, std::complex<float> x);
542PMT_API void c64vector_set(pmt_t v, size_t k, std::complex<double> x);
543
544// Return const pointers to the elements
545
546PMT_API const void*
547uniform_vector_elements(pmt_t v, size_t& len); //< works with any; len is in bytes
548
549PMT_API const uint8_t* u8vector_elements(pmt_t v, size_t& len); //< len is in elements
550PMT_API const int8_t* s8vector_elements(pmt_t v, size_t& len); //< len is in elements
551PMT_API const uint16_t* u16vector_elements(pmt_t v, size_t& len); //< len is in elements
552PMT_API const int16_t* s16vector_elements(pmt_t v, size_t& len); //< len is in elements
553PMT_API const uint32_t* u32vector_elements(pmt_t v, size_t& len); //< len is in elements
554PMT_API const int32_t* s32vector_elements(pmt_t v, size_t& len); //< len is in elements
555PMT_API const uint64_t* u64vector_elements(pmt_t v, size_t& len); //< len is in elements
556PMT_API const int64_t* s64vector_elements(pmt_t v, size_t& len); //< len is in elements
557PMT_API const float* f32vector_elements(pmt_t v, size_t& len); //< len is in elements
558PMT_API const double* f64vector_elements(pmt_t v, size_t& len); //< len is in elements
559PMT_API const std::complex<float>* c32vector_elements(pmt_t v,
560 size_t& len); //< len is in elements
561PMT_API const std::complex<double>*
562c64vector_elements(pmt_t v, size_t& len); //< len is in elements
563
564// len is in elements
565PMT_API const std::vector<uint8_t> u8vector_elements(pmt_t v);
566PMT_API const std::vector<int8_t> s8vector_elements(pmt_t v);
567PMT_API const std::vector<uint16_t> u16vector_elements(pmt_t v);
568PMT_API const std::vector<int16_t> s16vector_elements(pmt_t v);
569PMT_API const std::vector<uint32_t> u32vector_elements(pmt_t v);
570PMT_API const std::vector<int32_t> s32vector_elements(pmt_t v);
571PMT_API const std::vector<uint64_t> u64vector_elements(pmt_t v);
572PMT_API const std::vector<int64_t> s64vector_elements(pmt_t v);
573PMT_API const std::vector<float> f32vector_elements(pmt_t v);
574PMT_API const std::vector<double> f64vector_elements(pmt_t v);
575PMT_API const std::vector<std::complex<float> > c32vector_elements(pmt_t v);
576PMT_API const std::vector<std::complex<double> > c64vector_elements(pmt_t v);
577
578// len is in elements
579PMT_API const std::vector<uint8_t> pmt_u8vector_elements(pmt_t v);
580PMT_API const std::vector<int8_t> pmt_s8vector_elements(pmt_t v);
581PMT_API const std::vector<uint16_t> pmt_u16vector_elements(pmt_t v);
582PMT_API const std::vector<int16_t> pmt_s16vector_elements(pmt_t v);
583PMT_API const std::vector<uint32_t> pmt_u32vector_elements(pmt_t v);
584PMT_API const std::vector<int32_t> pmt_s32vector_elements(pmt_t v);
585PMT_API const std::vector<uint64_t> pmt_u64vector_elements(pmt_t v);
586PMT_API const std::vector<int64_t> pmt_s64vector_elements(pmt_t v);
587PMT_API const std::vector<float> pmt_f32vector_elements(pmt_t v);
588PMT_API const std::vector<double> pmt_f64vector_elements(pmt_t v);
589PMT_API const std::vector<std::complex<float> > pmt_c32vector_elements(pmt_t v);
590PMT_API const std::vector<std::complex<double> > pmt_c64vector_elements(pmt_t v);
591
592// Return non-const pointers to the elements
593
594PMT_API void*
596 size_t& len); //< works with any; len is in bytes
597
598PMT_API uint8_t* u8vector_writable_elements(pmt_t v, size_t& len); //< len is in elements
599PMT_API int8_t* s8vector_writable_elements(pmt_t v, size_t& len); //< len is in elements
601 size_t& len); //< len is in elements
602PMT_API int16_t* s16vector_writable_elements(pmt_t v, size_t& len); //< len is in elements
604 size_t& len); //< len is in elements
605PMT_API int32_t* s32vector_writable_elements(pmt_t v, size_t& len); //< len is in elements
607 size_t& len); //< len is in elements
608PMT_API int64_t* s64vector_writable_elements(pmt_t v, size_t& len); //< len is in elements
609PMT_API float* f32vector_writable_elements(pmt_t v, size_t& len); //< len is in elements
610PMT_API double* f64vector_writable_elements(pmt_t v, size_t& len); //< len is in elements
611PMT_API std::complex<float>*
612c32vector_writable_elements(pmt_t v, size_t& len); //< len is in elements
613PMT_API std::complex<double>*
614c64vector_writable_elements(pmt_t v, size_t& len); //< len is in elements
615
616/*
617 * ------------------------------------------------------------------------
618 * Dictionary (a.k.a associative array, hash, map)
619 *
620 * This is a functional data structure that is persistent. Updating a
621 * functional data structure does not destroy the existing version, but
622 * rather creates a new version that coexists with the old.
623 * ------------------------------------------------------------------------
624 */
625
626//! Return true if \p obj is a dictionary (warning: also returns true for a pair)
627PMT_API bool is_dict(const pmt_t& obj);
628
629//! Make an empty dictionary
631
632//! Return a new dictionary with \p key associated with \p value.
633PMT_API pmt_t dict_add(const pmt_t& dict, const pmt_t& key, const pmt_t& value);
634
635//! Return a new dictionary with \p key removed.
636PMT_API pmt_t dict_delete(const pmt_t& dict, const pmt_t& key);
637
638//! Return true if \p key exists in \p dict
639PMT_API bool dict_has_key(const pmt_t& dict, const pmt_t& key);
640
641//! If \p key exists in \p dict, return associated value; otherwise return \p not_found.
642PMT_API pmt_t dict_ref(const pmt_t& dict, const pmt_t& key, const pmt_t& not_found);
643
644//! Return list of (key . value) pairs
646
647//! Return list of keys
649
650//! Return a new dictionary \p dict1 with k=>v pairs from \p dict2 added.
651PMT_API pmt_t dict_update(const pmt_t& dict1, const pmt_t& dict2);
652
653//! Return list of values
655
656/*
657 * ------------------------------------------------------------------------
658 * Any (wraps boost::any -- can be used to wrap pretty much anything)
659 *
660 * Cannot be serialized or used across process boundaries.
661 * See http://www.boost.org/doc/html/any.html
662 * ------------------------------------------------------------------------
663 */
664
665//! Return true if \p obj is an any
667
668//! make an any
669PMT_API pmt_t make_any(const boost::any& any);
670
671//! Return underlying boost::any
672PMT_API boost::any any_ref(pmt_t obj);
673
674//! Store \p any in \p obj
675PMT_API void any_set(pmt_t obj, const boost::any& any);
676
677
678/*
679 * ------------------------------------------------------------------------
680 * msg_accepter -- pmt representation of pmt::msg_accepter
681 * ------------------------------------------------------------------------
682 */
683//! Return true if \p obj is a msg_accepter
685
686//! make a msg_accepter
687PMT_API pmt_t make_msg_accepter(boost::shared_ptr<gr::messages::msg_accepter> ma);
688
689//! Return underlying msg_accepter
690PMT_API boost::shared_ptr<gr::messages::msg_accepter> msg_accepter_ref(const pmt_t& obj);
691
692/*
693 * ------------------------------------------------------------------------
694 * General functions
695 * ------------------------------------------------------------------------
696 */
697
698//! Return true if x and y are the same object; otherwise return false.
699PMT_API bool eq(const pmt_t& x, const pmt_t& y);
700
701/*!
702 * \brief Return true if x and y should normally be regarded as the same object, else
703 * false.
704 *
705 * <pre>
706 * eqv returns true if:
707 * x and y are the same object.
708 * x and y are both \#t or both \#f.
709 * x and y are both symbols and their names are the same.
710 * x and y are both numbers, and are numerically equal.
711 * x and y are both the empty list (nil).
712 * x and y are pairs or vectors that denote same location in store.
713 * </pre>
714 */
715PMT_API bool eqv(const pmt_t& x, const pmt_t& y);
716
717/*!
718 * pmt::equal recursively compares the contents of pairs and vectors,
719 * applying pmt::eqv on other objects such as numbers and symbols.
720 * pmt::equal may fail to terminate if its arguments are circular data
721 * structures.
722 */
723PMT_API bool equal(const pmt_t& x, const pmt_t& y);
724
725
726//! Return the number of elements in v
727PMT_API size_t length(const pmt_t& v);
728
729/*!
730 * \brief Find the first pair in \p alist whose car field is \p obj
731 * and return that pair.
732 *
733 * \p alist (for "association list") must be a list of pairs. If no pair
734 * in \p alist has \p obj as its car then \#f is returned.
735 * Uses pmt::eq to compare \p obj with car fields of the pairs in \p alist.
736 */
738
739/*!
740 * \brief Find the first pair in \p alist whose car field is \p obj
741 * and return that pair.
742 *
743 * \p alist (for "association list") must be a list of pairs. If no pair
744 * in \p alist has \p obj as its car then \#f is returned.
745 * Uses pmt::eqv to compare \p obj with car fields of the pairs in \p alist.
746 */
748
749/*!
750 * \brief Find the first pair in \p alist whose car field is \p obj
751 * and return that pair.
752 *
753 * \p alist (for "association list") must be a list of pairs. If no pair
754 * in \p alist has \p obj as its car then \#f is returned.
755 * Uses pmt::equal to compare \p obj with car fields of the pairs in \p alist.
756 */
758
759/*!
760 * \brief Apply \p proc element-wise to the elements of list and returns
761 * a list of the results, in order.
762 *
763 * \p list must be a list. The dynamic order in which \p proc is
764 * applied to the elements of \p list is unspecified.
765 */
766PMT_API pmt_t map(pmt_t proc(const pmt_t&), pmt_t list);
767
768/*!
769 * \brief reverse \p list.
770 *
771 * \p list must be a proper list.
772 */
774
775/*!
776 * \brief destructively reverse \p list.
777 *
778 * \p list must be a proper list.
779 */
781
782/*!
783 * \brief (acons x y a) == (cons (cons x y) a)
784 */
785inline static pmt_t acons(pmt_t x, pmt_t y, pmt_t a) { return cons(cons(x, y), a); }
786
787/*!
788 * \brief locates \p nth element of \n list where the car is the 'zeroth' element.
789 */
790PMT_API pmt_t nth(size_t n, pmt_t list);
791
792/*!
793 * \brief returns the tail of \p list that would be obtained by calling
794 * cdr \p n times in succession.
795 */
796PMT_API pmt_t nthcdr(size_t n, pmt_t list);
797
798/*!
799 * \brief Return the first sublist of \p list whose car is \p obj.
800 * If \p obj does not occur in \p list, then \#f is returned.
801 * pmt::memq use pmt::eq to compare \p obj with the elements of \p list.
802 */
804
805/*!
806 * \brief Return the first sublist of \p list whose car is \p obj.
807 * If \p obj does not occur in \p list, then \#f is returned.
808 * pmt::memv use pmt::eqv to compare \p obj with the elements of \p list.
809 */
811
812/*!
813 * \brief Return the first sublist of \p list whose car is \p obj.
814 * If \p obj does not occur in \p list, then \#f is returned.
815 * pmt::member use pmt::equal to compare \p obj with the elements of \p list.
816 */
818
819/*!
820 * \brief Return true if every element of \p list1 appears in \p list2, and false
821 * otherwise. Comparisons are done with pmt::eqv.
822 */
824
825/*!
826 * \brief Return a list of length 1 containing \p x1
827 */
829
830/*!
831 * \brief Return a list of length 2 containing \p x1, \p x2
832 */
833PMT_API pmt_t list2(const pmt_t& x1, const pmt_t& x2);
834
835/*!
836 * \brief Return a list of length 3 containing \p x1, \p x2, \p x3
837 */
838PMT_API pmt_t list3(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3);
839
840/*!
841 * \brief Return a list of length 4 containing \p x1, \p x2, \p x3, \p x4
842 */
843PMT_API pmt_t list4(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4);
844
845/*!
846 * \brief Return a list of length 5 containing \p x1, \p x2, \p x3, \p x4, \p x5
847 */
849 const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4, const pmt_t& x5);
850
851/*!
852 * \brief Return a list of length 6 containing \p x1, \p x2, \p x3, \p x4, \p
853 * x5, \p x6
854 */
856 const pmt_t& x2,
857 const pmt_t& x3,
858 const pmt_t& x4,
859 const pmt_t& x5,
860 const pmt_t& x6);
861
862/*!
863 * \brief Return \p list with \p item added to it.
864 */
865PMT_API pmt_t list_add(pmt_t list, const pmt_t& item);
866
867/*!
868 * \brief Return \p list with \p item removed from it.
869 */
870PMT_API pmt_t list_rm(pmt_t list, const pmt_t& item);
871
872/*!
873 * \brief Return bool of \p list contains \p item
874 */
875PMT_API bool list_has(pmt_t list, const pmt_t& item);
876
877
878/*
879 * ------------------------------------------------------------------------
880 * read / write
881 * ------------------------------------------------------------------------
882 */
883
884//! return true if obj is the EOF object, otherwise return false.
886
887/*!
888 * read converts external representations of pmt objects into the
889 * objects themselves. Read returns the next object parsable from
890 * the given input port, updating port to point to the first
891 * character past the end of the external representation of the
892 * object.
893 *
894 * If an end of file is encountered in the input before any
895 * characters are found that can begin an object, then an end of file
896 * object is returned. The port remains open, and further attempts
897 * to read will also return an end of file object. If an end of file
898 * is encountered after the beginning of an object's external
899 * representation, but the external representation is incomplete and
900 * therefore not parsable, an error is signaled.
901 */
902PMT_API pmt_t read(std::istream& port);
903
904/*!
905 * Write a written representation of \p obj to the given \p port.
906 */
907PMT_API void write(pmt_t obj, std::ostream& port);
908
909/*!
910 * Return a string representation of \p obj.
911 * This is the same output as would be generated by pmt::write.
912 */
913PMT_API std::string write_string(pmt_t obj);
914
915
916PMT_API std::ostream& operator<<(std::ostream& os, pmt_t obj);
917
918/*!
919 * \brief Write pmt string representation to stdout.
920 */
922
923
924/*
925 * ------------------------------------------------------------------------
926 * portable byte stream representation
927 * ------------------------------------------------------------------------
928 */
929/*!
930 * \brief Write portable byte-serial representation of \p obj to \p sink
931 */
932PMT_API bool serialize(pmt_t obj, std::streambuf& sink);
933
934/*!
935 * \brief Create obj from portable byte-serial representation
936 */
937PMT_API pmt_t deserialize(std::streambuf& source);
938
939
940PMT_API void dump_sizeof(); // debugging
941
942/*!
943 * \brief Provide a simple string generating interface to pmt's serialize function
944 */
945PMT_API std::string serialize_str(pmt_t obj);
946
947/*!
948 * \brief Provide a simple string generating interface to pmt's deserialize function
949 */
951
952/*!
953 * \brief Provide a comparator function object to allow pmt use in stl types
954 */
956{
957public:
958 bool operator()(pmt::pmt_t const& p1, pmt::pmt_t const& p2) const
959 {
960 return pmt::eqv(p1, p2) ? false : p1.get() > p2.get();
961 }
962};
963
964// FIXME: Remove in 3.8.
966{
967public:
968 bool operator()(pmt::pmt_t const& p1, pmt::pmt_t const& p2) const
969 {
970 return pmt::eqv(p1, p2) ? false : p1.get() > p2.get();
971 }
972};
973
974} /* namespace pmt */
975
976#include <pmt/pmt_sugar.h>
977
978#endif /* INCLUDED_PMT_H */
Definition: alist.h:45
Provide a comparator function object to allow pmt use in stl types.
Definition: pmt.h:956
bool operator()(pmt::pmt_t const &p1, pmt::pmt_t const &p2) const
Definition: pmt.h:958
Definition: pmt.h:966
bool operator()(pmt::pmt_t const &p1, pmt::pmt_t const &p2) const
Definition: pmt.h:968
Definition: pmt.h:68
exception(const std::string &msg, pmt_t obj)
Definition: pmt.h:86
notimplemented(const std::string &msg, pmt_t obj)
Definition: pmt.h:80
out_of_range(const std::string &msg, pmt_t obj)
Definition: pmt.h:74
wrong_type(const std::string &msg, pmt_t obj)
#define PMT_API
Definition: gnuradio-runtime/include/pmt/api.h:30
static purpose_t msg
Definition: source_logger.h:39
Include this header to use the message passing features.
Definition: basic_block.h:45
Definition: pmt.h:51
PMT_API pmt_t string_to_symbol(const std::string &s)
Return the symbol whose name is s.
PMT_API void c64vector_set(pmt_t v, size_t k, std::complex< double > x)
PMT_API pmt_t dict_ref(const pmt_t &dict, const pmt_t &key, const pmt_t &not_found)
If key exists in dict, return associated value; otherwise return not_found.
PMT_API pmt_t reverse(pmt_t list)
reverse list.
PMT_API bool is_s16vector(pmt_t x)
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 cdar(pmt_t pair)
PMT_API pmt_t cdr(const pmt_t &pair)
If pair is a pair, return the cdr of the pair, otherwise raise wrong_type.
PMT_API uint64_t u64vector_ref(pmt_t v, size_t k)
PMT_API bool is_u32vector(pmt_t x)
PMT_API pmt_t make_rectangular(double re, double im)
Return a complex number constructed of the given real and imaginary parts.
PMT_API const void * uniform_vector_elements(pmt_t v, size_t &len)
PMT_API uint64_t to_uint64(pmt_t x)
Convert pmt to uint64 if possible.
PMT_API pmt_t init_u64vector(size_t k, const uint64_t *data)
PMT_API float f32vector_ref(pmt_t v, size_t k)
PMT_API uint8_t * u8vector_writable_elements(pmt_t v, size_t &len)
PMT_API pmt_t dict_items(pmt_t dict)
Return list of (key . value) pairs.
PMT_API double to_double(pmt_t x)
Convert pmt to double if possible.
PMT_API pmt_t make_s64vector(size_t k, int64_t fill)
PMT_API uint32_t u32vector_ref(pmt_t v, size_t k)
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 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 from_complex(double re, double im)
Return a complex number constructed of the given real and imaginary parts.
PMT_API pmt_t init_s8vector(size_t k, const int8_t *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 pmt_t list_add(pmt_t list, const pmt_t &item)
Return list with item added to it.
PMT_API size_t blob_length(pmt_t blob)
Return the blob's length in bytes.
PMT_API std::complex< float > * c32vector_writable_elements(pmt_t v, size_t &len)
PMT_API bool is_integer(pmt_t x)
Return true if x is an integer number, else false.
PMT_API std::complex< double > to_complex(pmt_t z)
PMT_API bool is_s32vector(pmt_t x)
PMT_API pmt_t init_u16vector(size_t k, const uint16_t *data)
PMT_API std::string serialize_str(pmt_t obj)
Provide a simple string generating interface to pmt's serialize function.
PMT_API pmt_t init_f64vector(size_t k, const double *data)
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 int16_t * s16vector_writable_elements(pmt_t v, size_t &len)
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 pmt_t init_u32vector(size_t k, const uint32_t *data)
PMT_API pmt_t cddr(pmt_t pair)
PMT_API pmt_t tuple_ref(const pmt_t &tuple, size_t k)
PMT_API pmt_t init_s16vector(size_t k, const int16_t *data)
PMT_API void write(pmt_t obj, std::ostream &port)
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 void s32vector_set(pmt_t v, size_t k, int32_t x)
PMT_API void set_cdr(pmt_t pair, pmt_t value)
Stores value in the cdr field of pair.
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 pmt_t intern(const std::string &s)
Alias for pmt_string_to_symbol.
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 bool is_s8vector(pmt_t x)
PMT_API pmt_t cadr(pmt_t pair)
PMT_API pmt_t init_s32vector(size_t k, const int32_t *data)
PMT_API const std::vector< uint16_t > pmt_u16vector_elements(pmt_t v)
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.
PMT_API pmt_t make_tuple()
PMT_API const std::vector< uint8_t > pmt_u8vector_elements(pmt_t v)
PMT_API bool is_c64vector(pmt_t x)
PMT_API bool is_u8vector(pmt_t x)
PMT_API pmt_t list_rm(pmt_t list, const pmt_t &item)
Return list with item removed from it.
PMT_API std::complex< float > c32vector_ref(pmt_t v, size_t k)
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.
PMT_API void vector_fill(pmt_t vector, pmt_t fill)
Store fill in every position of vector.
PMT_API const std::vector< int16_t > pmt_s16vector_elements(pmt_t v)
PMT_API long to_long(pmt_t x)
Convert pmt to long 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,...
PMT_API int16_t s16vector_ref(pmt_t v, size_t k)
PMT_API uint8_t u8vector_ref(pmt_t v, size_t k)
PMT_API void set_car(pmt_t pair, pmt_t value)
Stores value in the car field of pair.
PMT_API pmt_t make_s16vector(size_t k, int16_t fill)
PMT_API uint64_t * u64vector_writable_elements(pmt_t v, size_t &len)
PMT_API pmt_t init_c64vector(size_t k, const std::complex< double > *data)
PMT_API pmt_t cadddr(pmt_t pair)
PMT_API pmt_t deserialize_str(std::string str)
Provide a simple string generating interface to pmt's deserialize function.
PMT_API const std::vector< uint32_t > pmt_u32vector_elements(pmt_t v)
PMT_API uint16_t * u16vector_writable_elements(pmt_t v, size_t &len)
PMT_API bool is_any(pmt_t obj)
Return true if obj is an any.
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 const double * f64vector_elements(pmt_t v, size_t &len)
PMT_API const uint32_t * u32vector_elements(pmt_t v, size_t &len)
PMT_API void intrusive_ptr_release(pmt_base *)
PMT_API bool is_symbol(const pmt_t &obj)
Return true if obj is a symbol, else false.
PMT_API const int32_t * s32vector_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 make_u8vector(size_t k, uint8_t fill)
PMT_API pmt_t dict_keys(pmt_t dict)
Return list of keys.
PMT_API bool is_blob(pmt_t x)
Return true if x is a blob, otherwise false.
PMT_API float to_float(pmt_t x)
Convert pmt to float if possible.
PMT_API void vector_set(pmt_t vector, size_t k, pmt_t obj)
Store obj in position k.
PMT_API bool is_complex(pmt_t obj)
return true if obj is a complex number, false otherwise.
PMT_API pmt_t get_PMT_EOF()
PMT_API bool equal(const pmt_t &x, const pmt_t &y)
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 make_u64vector(size_t k, uint64_t fill)
PMT_API pmt_t reverse_x(pmt_t list)
destructively reverse list.
PMT_API pmt_t init_f32vector(size_t k, const float *data)
PMT_API void dump_sizeof()
PMT_API const uint64_t * u64vector_elements(pmt_t v, size_t &len)
PMT_API uint16_t u16vector_ref(pmt_t v, size_t k)
PMT_API bool to_bool(pmt_t val)
Return true if val is pmt::True, return false when val is pmt::PMT_F,.
PMT_API pmt_t make_u32vector(size_t k, uint32_t fill)
PMT_API const std::string symbol_to_string(const pmt_t &sym)
PMT_API const std::vector< int8_t > pmt_s8vector_elements(pmt_t v)
PMT_API bool is_u64vector(pmt_t x)
PMT_API bool is_uint64(pmt_t x)
Return true if x is an uint64 number, else false.
PMT_API std::complex< double > * c64vector_writable_elements(pmt_t v, size_t &len)
PMT_API bool is_vector(pmt_t x)
Return true if x is a vector, otherwise false.
PMT_API void s64vector_set(pmt_t v, size_t k, int64_t x)
PMT_API void any_set(pmt_t obj, const boost::any &any)
Store any in obj.
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 const std::vector< float > pmt_f32vector_elements(pmt_t v)
PMT_API boost::shared_ptr< gr::messages::msg_accepter > msg_accepter_ref(const pmt_t &obj)
Return underlying msg_accepter.
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:785
PMT_API pmt_t make_c32vector(size_t k, std::complex< float > fill)
PMT_API const std::complex< float > * c32vector_elements(pmt_t v, size_t &len)
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 pmt_t make_msg_accepter(boost::shared_ptr< gr::messages::msg_accepter > ma)
make a msg_accepter
PMT_API const std::complex< double > * c64vector_elements(pmt_t v, size_t &len)
PMT_API pmt_t init_c32vector(size_t k, const std::complex< float > *data)
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_API pmt_t make_s32vector(size_t k, int32_t fill)
PMT_API const int64_t * s64vector_elements(pmt_t v, size_t &len)
PMT_API size_t length(const pmt_t &v)
Return the number of elements in v.
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 car(const pmt_t &pair)
If pair is a pair, return the car of the pair, otherwise raise wrong_type.
PMT_API uint32_t * u32vector_writable_elements(pmt_t v, size_t &len)
PMT_API pmt_t make_c64vector(size_t k, std::complex< double > fill)
PMT_API pmt_t list1(const pmt_t &x1)
Return a list of length 1 containing x1.
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_u16vector(size_t k, uint16_t fill)
PMT_API double f64vector_ref(pmt_t v, size_t k)
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 double * f64vector_writable_elements(pmt_t v, size_t &len)
PMT_API bool is_false(pmt_t obj)
Return true if obj is #f, else return true.
PMT_API void u16vector_set(pmt_t v, size_t k, uint16_t x)
PMT_API bool is_real(pmt_t obj)
PMT_API pmt_t dict_values(pmt_t dict)
Return list of values.
PMT_API void s8vector_set(pmt_t v, size_t k, int8_t x)
PMT_API pmt_t dict_delete(const pmt_t &dict, const pmt_t &key)
Return a new dictionary with key removed.
PMT_API bool is_tuple(pmt_t x)
Return true if x is a tuple, otherwise false.
PMT_API std::string write_string(pmt_t obj)
PMT_API const uint8_t * u8vector_elements(pmt_t v, size_t &len)
PMT_API pmt_t from_long(long x)
Return the pmt value that represents the integer x.
PMT_API pmt_t make_blob(const void *buf, size_t len)
Make a blob given a pointer and length in bytes.
PMT_API const std::vector< double > pmt_f64vector_elements(pmt_t v)
PMT_API boost::any any_ref(pmt_t obj)
Return underlying boost::any.
PMT_API std::ostream & operator<<(std::ostream &os, pmt_t obj)
PMT_API void f64vector_set(pmt_t v, size_t k, double x)
PMT_API void u8vector_set(pmt_t v, size_t k, uint8_t x)
PMT_API const std::vector< std::complex< float > > pmt_c32vector_elements(pmt_t v)
PMT_API bool is_msg_accepter(const pmt_t &obj)
Return true if obj is a msg_accepter.
PMT_API pmt_t make_s8vector(size_t k, int8_t fill)
boost::intrusive_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting). See http://www.boost....
Definition: pmt.h:56
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...
PMT_API pmt_t init_u8vector(size_t k, const uint8_t *data)
PMT_API void u64vector_set(pmt_t v, size_t k, uint64_t x)
PMT_API const std::vector< int64_t > pmt_s64vector_elements(pmt_t v)
PMT_API pmt_t make_dict()
Make an empty dictionary.
PMT_API pmt_t make_any(const boost::any &any)
make an any
PMT_API bool is_s64vector(pmt_t x)
PMT_API int64_t s64vector_ref(pmt_t v, size_t k)
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 pmt_t list2(const pmt_t &x1, const pmt_t &x2)
Return a list of length 2 containing x1, x2.
PMT_API bool is_true(pmt_t obj)
Return false if obj is #f, else return true.
PMT_API int64_t * s64vector_writable_elements(pmt_t v, size_t &len)
PMT_API pmt_t make_f64vector(size_t k, double fill)
PMT_API void u32vector_set(pmt_t v, size_t k, uint32_t x)
PMT_API void c32vector_set(pmt_t v, size_t k, std::complex< float > x)
PMT_API pmt_t caar(pmt_t pair)
PMT_API pmt_t make_f32vector(size_t k, float fill)
PMT_API void print(pmt_t v)
Write pmt string representation to stdout.
PMT_API int32_t * s32vector_writable_elements(pmt_t v, size_t &len)
PMT_API const std::vector< int32_t > pmt_s32vector_elements(pmt_t v)
PMT_API pmt_t deserialize(std::streambuf &source)
Create obj from portable byte-serial representation.
PMT_API pmt_t from_double(double x)
Return the pmt value that represents double x.
PMT_API int32_t s32vector_ref(pmt_t v, size_t k)
PMT_API const std::vector< uint64_t > pmt_u64vector_elements(pmt_t v)
PMT_API pmt_t to_tuple(const pmt_t &x)
PMT_API int8_t s8vector_ref(pmt_t v, size_t k)
PMT_API pmt_t init_s64vector(size_t k, const int64_t *data)
PMT_API pmt_t get_PMT_F()
PMT_API pmt_t get_PMT_T()
PMT_API pmt_t caddr(pmt_t pair)
PMT_API void s16vector_set(pmt_t v, size_t k, int16_t x)
PMT_API void intrusive_ptr_add_ref(pmt_base *)
PMT_API std::complex< double > c64vector_ref(pmt_t v, size_t k)
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 const float * f32vector_elements(pmt_t v, size_t &len)
PMT_API void * uniform_vector_writable_elements(pmt_t v, size_t &len)
PMT_API bool list_has(pmt_t list, const pmt_t &item)
Return bool of list contains item.
PMT_API pmt_t from_float(float x)
PMT_API bool is_bool(pmt_t obj)
Return true if obj is #t or #f, else return false.
PMT_API bool is_uniform_vector(pmt_t x)
true if x is any kind of uniform numeric vector
PMT_API const uint16_t * u16vector_elements(pmt_t v, size_t &len)
PMT_API const int8_t * s8vector_elements(pmt_t v, size_t &len)
PMT_API pmt_t pmt_from_complex(double re, double im)
Return a complex number constructed of the given real and imaginary parts.
PMT_API const void * blob_data(pmt_t blob)
Return a pointer to the blob's data.
PMT_API bool is_c32vector(pmt_t x)
PMT_API bool is_null(const pmt_t &x)
Return true if x is the empty list, otherwise return false.
PMT_API bool is_f64vector(pmt_t x)
PMT_API pmt_t get_PMT_NIL()
PMT_API bool is_u16vector(pmt_t x)
PMT_API pmt_t read(std::istream &port)
PMT_API bool is_number(pmt_t obj)
Return true if obj is any kind of number, else false.
PMT_API const std::vector< std::complex< double > > pmt_c64vector_elements(pmt_t v)
PMT_API pmt_t vector_ref(pmt_t vector, size_t k)
PMT_API const int16_t * s16vector_elements(pmt_t v, size_t &len)
PMT_API int8_t * s8vector_writable_elements(pmt_t v, size_t &len)
PMT_API bool serialize(pmt_t obj, std::streambuf &sink)
Write portable byte-serial representation of obj to sink.
PMT_API float * f32vector_writable_elements(pmt_t v, size_t &len)
PMT_API bool is_f32vector(pmt_t x)
PMT_API pmt_t from_uint64(uint64_t x)
Return the pmt value that represents the uint64 x.
PMT_API void f32vector_set(pmt_t v, size_t k, float x)
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 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.
Definition: cc_common.h:45