discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] pmt_dict API change in master


From: Eric Blossom
Subject: [Discuss-gnuradio] pmt_dict API change in master
Date: Mon, 8 Mar 2010 17:43:37 -0800
User-agent: Mutt/1.5.20 (2009-08-17)

Changeset cbbe4816f99ac introduces an API change in the pmt library.

I doubt that this change will cause problems for anyone, but if does,
see below for the changes you'll have to make to your code.

With the change, pmt_dict becomes an immutable object ("persistent" in
functional programming lingo), and is now safe to pass in messages.

The primary change is that the old key/value setter:

  //! dict[key] = value
  void  pmt_dict_set(pmt_t dict, pmt_t key, pmt_t value);

is replaced with:

  //! Return a new dictionary with \p key associated with \p value.
  pmt_t pmt_dict_add(const pmt_t &dict, const pmt_t &key, const pmt_t &value);

It returns a new dictionary with the key, value association added.
The previous dictionary is unchanged.

There is also a new function that returns a version of a dictionary
with a key removed:

  //! Return a new dictionary with \p key removed.
  pmt_t pmt_dict_delete(const pmt_t &dict, const pmt_t &key);


The new implementation is simple-minded.  If it gets to be a
performance problem, we can replace it with a persistent red-black
tree or something similar.

Eric




reply via email to

[Prev in Thread] Current Thread [Next in Thread]