Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

?Missing? documentation to add a new type #1508

Open
bam241 opened this issue May 15, 2019 · 2 comments
Open

?Missing? documentation to add a new type #1508

bam241 opened this issue May 15, 2019 · 2 comments

Comments

@bam241
Copy link
Member

bam241 commented May 15, 2019

to add a new supported type in Cyclus, needs to be done:

  • add you type in the DbTypes enum list in src/query_backend.h

    • each variation length type (used in you custom type) need to be both as TYPE and VL_TYPE
      • each line need a comment formatted as follow:
        // {"c++ type (with namespacing etc...)", NB_OF_VL_TYPE, ["HDF5","SQLite"],["CYCLUS TYPE DEFINITION"],true/false]
      • the "CYCLUS TYPE DEFINITION" should be:
        • for std::map<X,Y> : ["MAP", "X", "Y"] or ["VL_MAP","X","Y"]
        • for a std::vector<Z>: ["VECTOR","Z"] or ["VL_VECTOR","Z"]
        • ...
      • I am not sure what the true or false rule is...
      • HDF5 and/or Sqlite should appear depending on needs (at least one is required)
  • add the inline void Update( method at the end of the src/query_backend.h file in the Sha1 class

  • for SQLite type support (i.e. if you added "SQLite" in the comment) edit src/sqlite_back.cc in 3 locations:

    • add you method in #define CYCLUS_BINDVAL(D, T):

      • add a method mapping your new type with Cyclus naming:
        • replace , by CYCLUS_COMMA when describing the cpp type
        • cyclus naming is all capital underscore separation:
          - std::map<std::string, std::vector>->MAP_STRING_VECTOR_DOUBLE`
    • the same way add you method in #define CYCLUS_LOADVAL(D, T)

    • add you type in DbTypes SqliteBack::Type( :

      • type_map[&typeid(FULL_CPP_TYPE_WITH_NAMESPACE)] = CYCLUS_NAME_TYPE
      • in this case the CYCLUS_NAME_TYPE is the one described just before
        - std::map<std::string, std::vector>->MAP_STRING_VECTOR_DOUBLE`
  • for HDF5 it should be done automaticity (hopefully), a git clean -fx might be required (clear all file not followed by git)

with that you should be good to go !

@bam241 bam241 changed the title ?Missing? doc to add a new type ?Missing? documentation to add a new type May 15, 2019
@bam241
Copy link
Member Author

bam241 commented May 15, 2019

(Note this might not be complete, feel free to add anything I might have missed

@gwenchee
Copy link
Contributor

An example of the addition of a new type can be seen in #1490

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants