gnuradio / pmt

pmt
GNU Lesser General Public License v3.0
11 stars 11 forks source link

Pmt vectors #29

Closed jsallay closed 2 years ago

jsallay commented 2 years ago

Add in support for vectors of pmts. Addresses https://github.com/gnuradio/pmt/issues/6

jsallay commented 2 years ago

I am adding in unit tests and I think that this is working out to be pretty cool. I can declare a vector like this.

vector<pmt> x{5, "abc", std::complex<float>(1.0, -2.0), scalar<int>(3), pmt("z")};
mormj commented 2 years ago

Tested it out with newsched and a few small tweaks that I'll put in another PR. Merging

jsallay commented 2 years ago

I need to open an issue for that.

I don't believe that bool will pass any is_arithmetic checks, so I would just need to make sure that it works properly with everything else.

On Tue, Jan 18, 2022, 4:01 PM mormj @.***> wrote:

@.**** commented on this pull request.

In include/pmtf/wrap.hpp https://github.com/gnuradio/pmt/pull/29#discussion_r787146302:

  • //std::cout << "Yo<<: " << (uint32_t)value.data_type() << std::endl;
  • switch(value.data_type()) {
  • case Data::PmtString: return operator<<(os, string(value));
  • case Data::ScalarFloat32: return operator<<(os, scalar(value));
  • case Data::ScalarFloat64: return operator<<(os, scalar(value));
  • case Data::ScalarComplex64: return operator<<(os, scalar<std::complex>(value));
  • case Data::ScalarComplex128: return operator<<(os, scalar<std::complex>(value));
  • case Data::ScalarInt8: return operator<<(os, scalar(value));
  • case Data::ScalarInt16: return operator<<(os, scalar(value));
  • case Data::ScalarInt32: return operator<<(os, scalar(value));
  • case Data::ScalarInt64: return operator<<(os, scalar(value));
  • case Data::ScalarUInt8: return operator<<(os, scalar(value));
  • case Data::ScalarUInt16: return operator<<(os, scalar(value));
  • case Data::ScalarUInt32: return operator<<(os, scalar(value));
  • case Data::ScalarUInt64: return operator<<(os, scalar(value));
  • //case Data::ScalarBool: return operator<<(os, scalar(value));

Why no bool?

— Reply to this email directly, view it on GitHub https://github.com/gnuradio/pmt/pull/29#pullrequestreview-855968338, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHPWDXGLDEZXXGMBW3SLDLDUWXIKXANCNFSM5MBAS6XA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

jsallay commented 2 years ago

Wrap really exists now as a run around the resolution order of the compiler.

I have to declare a lot of the functions like operator== after all of the classes have been defined so that I can cast the pmt to those classes.

The file should be renamed to something that better represents this. I also think that we need a pmt.h that collects all of the other headers. That way a user doesn't need to know all of the details.

On Tue, Jan 18, 2022, 4:03 PM mormj @.***> wrote:

@.**** commented on this pull request.

In include/pmtf/wrap.hpp https://github.com/gnuradio/pmt/pull/29#discussion_r787147354:

@@ -20,10 +20,15 @@ namespace pmtf { inline std::ostream& operator<<(std::ostream& os, const map& value); bool operator==(const pmt& x, const map& y); inline bool operator==(const map& y, const pmt& x) { return operator==(x,y); } -std::ostream& operator<<(std::ostream& os, const pmt& value);

What is the general purpose of wrap at this point since most everything that was wrap got moved into the base class

— Reply to this email directly, view it on GitHub https://github.com/gnuradio/pmt/pull/29#pullrequestreview-855969782, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHPWDXCXSLJPRYBUEMVYZXLUWXIQ5ANCNFSM5MBAS6XA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>