00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef O2SCL_COLLECTION_H
00024 #define O2SCL_COLLECTION_H
00025
00026 #include <iostream>
00027 #include <fstream>
00028 #include <string>
00029 #include <vector>
00030 #include <map>
00031 #include <set>
00032 #include <sstream>
00033 #include <o2scl/misc.h>
00034 #include <o2scl/err_hnd.h>
00035 #include <o2scl/test_mgr.h>
00036 #include <o2scl/text_file.h>
00037 #include <o2scl/file_format.h>
00038 #include <o2scl/file_detect.h>
00039 #include <o2scl/ovector_tlate.h>
00040 #include <o2scl/omatrix_tlate.h>
00041 #include <o2scl/ovector_cx_tlate.h>
00042 #include <o2scl/omatrix_cx_tlate.h>
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 #ifndef DOXYGENP
00066 namespace o2scl {
00067 #endif
00068
00069
00070
00071
00072
00073 typedef struct {
00074
00075 void *data;
00076
00077 int size;
00078
00079 int size2;
00080
00081 bool owner;
00082
00083 class io_base *iop;
00084 } collection_entry;
00085
00086
00087
00088
00089
00090 typedef struct {
00091
00092 std::string name;
00093
00094 collection_entry *ep;
00095
00096 bool output;
00097 } pointer_output;
00098
00099
00100
00101
00102
00103 typedef struct {
00104
00105 std::string name;
00106
00107 void **ptr;
00108
00109 std::string stype;
00110 } pointer_input;
00111
00112
00113 class cinput;
00114
00115 class coutput;
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127 class io_base {
00128
00129 #ifndef DOXYGEN_INTERNAL
00130
00131 protected:
00132
00133
00134 friend class io_type_info;
00135
00136
00137 friend class collection;
00138
00139 friend class cinput;
00140 friend class coutput;
00141 friend class io_manager;
00142
00143
00144 static class io_manager *iom;
00145
00146
00147 static int objs_count;
00148
00149
00150 virtual int stat_in_noobj(cinput *co, in_file_format *ins);
00151
00152
00153 virtual int stat_out_noobj(coutput *co, out_file_format *outs);
00154
00155
00156
00157 virtual int in_wrapper(cinput *co, in_file_format *ins, void *&vp);
00158
00159
00160
00161 virtual int in_wrapper(cinput *co, in_file_format *ins, void *&vp,
00162 int &sz);
00163
00164
00165
00166 virtual int in_wrapper(cinput *co, in_file_format *ins, void *&vp,
00167 int &sz, int &sz2);
00168
00169
00170
00171
00172 virtual int out_wrapper(coutput *co, out_file_format *outs,
00173 void *vp, int sz, int sz2);
00174
00175
00176 virtual int object_in_void(cinput *cin, in_file_format *ins, void *op,
00177 std::string &name);
00178
00179
00180 virtual int object_in_void(cinput *cin, in_file_format *ins, void *op,
00181 int sz, std::string &name);
00182
00183
00184 virtual int object_in_void(cinput *cin, in_file_format *ins, void *op,
00185 int sz, int sz2, std::string &name);
00186
00187
00188 virtual int object_in_mem_void(cinput *cin, in_file_format *ins,
00189 void *&op, std::string &name);
00190
00191
00192 virtual int object_in_mem_void(cinput *cin, in_file_format *ins,
00193 void *&op, int &sz, std::string &name);
00194
00195
00196 virtual int object_in_mem_void(cinput *cin, in_file_format *ins,
00197 void *&op, int &sz, int &sz2,
00198 std::string &name);
00199
00200
00201 virtual int object_out_void(coutput *cout, out_file_format *outs,
00202 void *op, int sz, int sz2,
00203 std::string name="");
00204
00205
00206
00207
00208 int sw_store;
00209
00210
00211
00212
00213
00214 virtual int remove(void *vp) { return 0; }
00215
00216
00217 virtual int remove_arr(void *vp) {
00218 return 0;
00219 }
00220
00221
00222 virtual int remove_2darr(void *vp, int sz) { return 0; }
00223
00224
00225 #endif
00226
00227 public:
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239 io_base(int sw=0);
00240
00241
00242
00243
00244 io_base(const char *t);
00245
00246 virtual ~io_base();
00247
00248
00249
00250
00251 virtual const char *type() { return "io_base"; }
00252
00253
00254 virtual bool has_static_data() { return false; }
00255
00256
00257
00258
00259
00260
00261 virtual int pointer_in(cinput *co, in_file_format *ins, void **pp,
00262 std::string &stype);
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273 virtual int pointer_out(coutput *co, out_file_format *outs, void *ptr,
00274 std::string stype);
00275
00276
00277 };
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288 class io_manager {
00289
00290 public:
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300 int add_type(io_base *iop);
00301
00302
00303 int is_type(io_base *iop);
00304
00305
00306 int add_type(io_base *iop, const char *t);
00307
00308
00309 int remove_type(io_base *iop);
00310
00311 #ifndef DOXYGEN_INTERNAL
00312
00313 protected:
00314
00315
00316 friend class io_base;
00317
00318
00319 friend class collection;
00320
00321
00322 friend class cinput;
00323
00324
00325 friend class coutput;
00326
00327
00328 friend class io_type_info;
00329
00330
00331 io_base *get_ptr(std::string stype);
00332
00333
00334 std::vector<io_base *> tlist;
00335
00336
00337 typedef std::vector<io_base *>::iterator titer;
00338
00339
00340 io_manager() {};
00341
00342 #endif
00343
00344 };
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355 class io_type_info : public io_base {
00356
00357 #ifndef DOXYGEN_INTERNAL
00358
00359 protected:
00360
00361
00362 friend class collection;
00363
00364
00365 int static_fout(coutput *co, out_file_format *out);
00366
00367
00368 int static_fout_restricted(coutput *co, out_file_format *out,
00369 std::set<std::string,string_comp> list);
00370
00371
00372 typedef std::vector<io_base *>::iterator titer;
00373
00374 #endif
00375
00376 public:
00377
00378 io_type_info();
00379
00380 virtual ~io_type_info();
00381
00382
00383
00384
00385
00386
00387 int is_type(std::string stype);
00388
00389
00390
00391
00392
00393
00394
00395
00396 int remove_type(std::string stype);
00397
00398
00399
00400
00401
00402
00403
00404 virtual int clear_types();
00405
00406
00407 void type_summary(std::ostream *outs, bool pointers=false);
00408
00409
00410 int add_type(io_base *iop) { return iom->add_type(iop); }
00411
00412
00413 };
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488 class collection : public io_base {
00489
00490 #ifndef DOXYGEN_INTERNAL
00491
00492 protected:
00493
00494 friend class io_base;
00495 friend class cinput;
00496 friend class coutput;
00497
00498
00499 typedef std::map<std::string,collection_entry,string_comp>::iterator
00500 piter;
00501
00502
00503 std::map<std::string,collection_entry,string_comp> plist;
00504
00505 #endif
00506
00507 public:
00508
00509 collection() : io_base(1) {};
00510
00511 #ifdef O2SCL_NEVER_DEFINED
00512
00513 }
00514 {
00515 #endif
00516
00517 ~collection();
00518
00519
00520
00521
00522
00523 int fout(out_file_format *outs);
00524
00525
00526 int fout(std::string filename);
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539 int fin(std::string file_name, bool overwrt=false, int verbose=0);
00540
00541
00542 int fin(in_file_format *ins, bool overwrt=false, int verbose=0);
00543
00544
00545
00546
00547
00548
00549
00550 int test_type(o2scl::test_mgr &t, std::string stype, void *obj,
00551 void *&newobj, bool scrout=false);
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562 int rewrite(std::string in_name, std::string out_name);
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573 int disown(std::string name);
00574
00575
00576
00577 int summary(std::ostream *out, bool show_addresses=false);
00578
00579
00580
00581
00582
00583
00584
00585 int remove(std::string name);
00586
00587
00588
00589 void clear();
00590
00591
00592
00593 int size();
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606 int add_void(std::string name, io_base *tio, void *vec, int sz=0,
00607 int sz2=0, bool overwrt=true, bool owner=false);
00608
00609 int add_void(std::string name, std::string stype,
00610 void *vec, int sz=0, int sz2=0,
00611 bool overwrt=true, bool owner=false);
00612
00613
00614
00615
00616
00617 bool getb_def(std::string name, bool def_value) {
00618 piter pit=plist.find(name);
00619 if (pit!=plist.end()) {
00620 if (((std::string)pit->second.iop->type())=="bool") {
00621 if (pit->second.size!=0 || pit->second.size2!=0) {
00622 O2SCL_ERR("Size of object incorrect in collection::getc2().",
00623 gsl_efailed);
00624 return 0;
00625 }
00626 bool *wp=(bool *)(pit->second.data);
00627 return *wp;
00628 }
00629 }
00630 return def_value;
00631 }
00632
00633
00634 char getc_def(std::string name, char def_value) {
00635 piter pit=plist.find(name);
00636 if (pit!=plist.end()) {
00637 if (((std::string)pit->second.iop->type())=="char") {
00638 if (pit->second.size!=0 || pit->second.size2!=0) {
00639 O2SCL_ERR("Size of object incorrect in collection::getc2().",
00640 gsl_efailed);
00641 return 0;
00642 }
00643 char *wp=(char *)(pit->second.data);
00644 return *wp;
00645 }
00646 }
00647 return def_value;
00648 }
00649
00650
00651 double getd_def(std::string name, double def_value) {
00652 piter pit=plist.find(name);
00653 if (pit!=plist.end()) {
00654 if (((std::string)pit->second.iop->type())=="double") {
00655 if (pit->second.size!=0 || pit->second.size2!=0) {
00656 O2SCL_ERR("Size of object incorrect in collection::getd2().",
00657 gsl_efailed);
00658 return 0.0;
00659 }
00660 double *wp=(double *)(pit->second.data);
00661 return *wp;
00662 }
00663 }
00664 return def_value;
00665 }
00666
00667
00668 int geti_def(std::string name, int def_value) {
00669 piter pit=plist.find(name);
00670 if (pit!=plist.end()) {
00671 if (((std::string)pit->second.iop->type())=="int") {
00672 if (pit->second.size!=0 || pit->second.size2!=0) {
00673 O2SCL_ERR("Size of object incorrect in collection::geti2().",
00674 gsl_efailed);
00675 return 0;
00676 }
00677 int *wp=(int *)(pit->second.data);
00678 return *wp;
00679 }
00680 }
00681 return def_value;
00682 }
00683
00684
00685 std::string gets_def(std::string name, std::string def_value) {
00686 piter pit=plist.find(name);
00687 if (pit!=plist.end()) {
00688 if (((std::string)pit->second.iop->type())=="string") {
00689 if (pit->second.size!=0 || pit->second.size2!=0) {
00690 O2SCL_ERR("Size of object incorrect in collection::gets2().",
00691 gsl_efailed);
00692 return "";
00693 }
00694 std::string *wp=(std::string *)(pit->second.data);
00695 return *wp;
00696 }
00697 }
00698 return def_value;
00699 }
00700
00701
00702 std::string getw_def(std::string name, std::string def_value) {
00703 piter pit=plist.find(name);
00704 if (pit!=plist.end()) {
00705 if (((std::string)pit->second.iop->type())=="word") {
00706 if (pit->second.size!=0 || pit->second.size2!=0) {
00707 O2SCL_ERR("Size of object incorrect in collection::getw2().",
00708 gsl_efailed);
00709 return "";
00710 }
00711 std::string *wp=(std::string *)(pit->second.data);
00712 return *wp;
00713 }
00714 }
00715 return def_value;
00716 }
00717
00718
00719 bool getb(std::string name) {
00720 piter pit=plist.find(name);
00721 if (pit!=plist.end()) {
00722 if (((std::string)pit->second.iop->type())=="bool") {
00723 if (pit->second.size!=0 || pit->second.size2!=0) {
00724 O2SCL_ERR("Size of object incorrect in collection::getc2().",
00725 gsl_efailed);
00726 return 0;
00727 }
00728 bool *wp=(bool *)(pit->second.data);
00729 return *wp;
00730 }
00731 }
00732 O2SCL_ERR("Object not found in collection::getc2().",gsl_enotfound);
00733 return false;
00734 }
00735
00736
00737 char getc(std::string name) {
00738 piter pit=plist.find(name);
00739 if (pit!=plist.end()) {
00740 if (((std::string)pit->second.iop->type())=="char") {
00741 if (pit->second.size!=0 || pit->second.size2!=0) {
00742 O2SCL_ERR("Size of object incorrect in collection::getc2().",
00743 gsl_efailed);
00744 return 0;
00745 }
00746 char *wp=(char *)(pit->second.data);
00747 return *wp;
00748 }
00749 }
00750 O2SCL_ERR("Object not found in collection::getc2().",gsl_enotfound);
00751 return 0;
00752 }
00753
00754
00755 double getd(std::string name) {
00756 piter pit=plist.find(name);
00757 if (pit!=plist.end()) {
00758 if (((std::string)pit->second.iop->type())=="double") {
00759 if (pit->second.size!=0 || pit->second.size2!=0) {
00760 O2SCL_ERR("Size of object incorrect in collection::getd2().",
00761 gsl_efailed);
00762 return 0.0;
00763 }
00764 double *wp=(double *)(pit->second.data);
00765 return *wp;
00766 }
00767 }
00768 O2SCL_ERR("Object not found in collection::getd2().",gsl_enotfound);
00769 return 0.0;
00770 }
00771
00772
00773 int geti(std::string name) {
00774 piter pit=plist.find(name);
00775 if (pit!=plist.end()) {
00776 if (((std::string)pit->second.iop->type())=="int") {
00777 if (pit->second.size!=0 || pit->second.size2!=0) {
00778 O2SCL_ERR("Size of object incorrect in collection::geti2().",
00779 gsl_efailed);
00780 return 0;
00781 }
00782 int *wp=(int *)(pit->second.data);
00783 return *wp;
00784 }
00785 }
00786 O2SCL_ERR("Object not found in collection::geti2().",gsl_enotfound);
00787 return 0;
00788 }
00789
00790
00791 std::string gets(std::string name) {
00792 piter pit=plist.find(name);
00793 if (pit!=plist.end()) {
00794 if (((std::string)pit->second.iop->type())=="string") {
00795 if (pit->second.size!=0 || pit->second.size2!=0) {
00796 O2SCL_ERR("Size of object incorrect in collection::gets2().",
00797 gsl_efailed);
00798 return "";
00799 }
00800 std::string *wp=(std::string *)(pit->second.data);
00801 return *wp;
00802 }
00803 }
00804 O2SCL_ERR("Object not found in collection::gets2().",gsl_enotfound);
00805 return "";
00806 }
00807
00808
00809 std::string getw(std::string name) {
00810 piter pit=plist.find(name);
00811 if (pit!=plist.end()) {
00812 if (((std::string)pit->second.iop->type())=="word") {
00813 if (pit->second.size!=0 || pit->second.size2!=0) {
00814 O2SCL_ERR("Size of object incorrect in collection::getw2().",
00815 gsl_efailed);
00816 return "";
00817 }
00818 std::string *wp=(std::string *)(pit->second.data);
00819 return *wp;
00820 }
00821 }
00822 O2SCL_ERR("Object not found in collection::getw2().",gsl_enotfound);
00823 return "";
00824 }
00825
00826
00827
00828 int getb(std::string name, bool *&op, size_t &sz) {
00829 op=0;
00830 piter pit=plist.find(name);
00831 if (pit!=plist.end()) {
00832 if (((std::string)pit->second.iop->type())=="bool") {
00833 if (pit->second.size==0 || pit->second.size2!=0) {
00834 O2SCL_ERR_RET("Size of object incorrect in collection::get2().",
00835 gsl_efailed);
00836 }
00837 op=(bool *)(pit->second.data);
00838 sz=pit->second.size;
00839 return gsl_success;
00840 }
00841 }
00842
00843
00844
00845
00846 return gsl_enotfound;
00847 }
00848
00849
00850 int getb(std::string name, bool **&op, size_t &sz,
00851 size_t &sz2) {
00852 op=0;
00853 piter pit=plist.find(name);
00854 if (pit!=plist.end()) {
00855 if (((std::string)pit->second.iop->type())=="bool") {
00856 if (pit->second.size==0 || pit->second.size2==0) {
00857 O2SCL_ERR_RET("Size of object incorrect in collection::get2().",
00858 gsl_efailed);
00859 }
00860 op=(bool **)(pit->second.data);
00861 sz=pit->second.size;
00862 sz2=pit->second.size2;
00863 return gsl_success;
00864 }
00865 }
00866
00867
00868
00869
00870 return gsl_enotfound;
00871 }
00872
00873
00874 int getc(std::string name, char *&op, size_t &sz) {
00875 op=0;
00876 piter pit=plist.find(name);
00877 if (pit!=plist.end()) {
00878 if (((std::string)pit->second.iop->type())=="char") {
00879 if (pit->second.size==0 || pit->second.size2!=0) {
00880 O2SCL_ERR_RET("Size of object incorrect in collection::get2().",
00881 gsl_efailed);
00882 }
00883 op=(char *)(pit->second.data);
00884 sz=pit->second.size;
00885 return gsl_success;
00886 }
00887 }
00888
00889
00890
00891
00892 return gsl_enotfound;
00893 }
00894
00895
00896 int getc(std::string name, char **&op, size_t &sz,
00897 size_t &sz2) {
00898 op=0;
00899 piter pit=plist.find(name);
00900 if (pit!=plist.end()) {
00901 if (((std::string)pit->second.iop->type())=="char") {
00902 if (pit->second.size==0 || pit->second.size2==0) {
00903 O2SCL_ERR_RET("Size of object incorrect in collection::get2().",
00904 gsl_efailed);
00905 }
00906 op=(char **)(pit->second.data);
00907 sz=pit->second.size;
00908 sz2=pit->second.size2;
00909 return gsl_success;
00910 }
00911 }
00912
00913
00914
00915
00916 return gsl_enotfound;
00917 }
00918
00919
00920 int getd(std::string name, double *&op, size_t &sz) {
00921 op=0;
00922 piter pit=plist.find(name);
00923 if (pit!=plist.end()) {
00924 if (((std::string)pit->second.iop->type())=="double") {
00925 if (pit->second.size==0 || pit->second.size2!=0) {
00926 O2SCL_ERR_RET("Size of object incorrect in collection::get2().",
00927 gsl_efailed);
00928 }
00929 op=(double *)(pit->second.data);
00930 sz=pit->second.size;
00931 return gsl_success;
00932 }
00933 }
00934
00935
00936
00937
00938 return gsl_enotfound;
00939 }
00940
00941
00942 int getd(std::string name, double **&op, size_t &sz,
00943 size_t &sz2) {
00944 op=0;
00945 piter pit=plist.find(name);
00946 if (pit!=plist.end()) {
00947 if (((std::string)pit->second.iop->type())=="double") {
00948 if (pit->second.size==0 || pit->second.size2==0) {
00949 O2SCL_ERR_RET("Size of object incorrect in collection::get2().",
00950 gsl_efailed);
00951 }
00952 op=(double **)(pit->second.data);
00953 sz=pit->second.size;
00954 sz2=pit->second.size2;
00955 return gsl_success;
00956 }
00957 }
00958
00959
00960
00961
00962 return gsl_enotfound;
00963 }
00964
00965
00966 int geti(std::string name, int *&op, size_t &sz) {
00967 op=0;
00968 piter pit=plist.find(name);
00969 if (pit!=plist.end()) {
00970 if (((std::string)pit->second.iop->type())=="int") {
00971 if (pit->second.size==0 || pit->second.size2!=0) {
00972 O2SCL_ERR_RET("Size of object incorrect in collection::get2().",
00973 gsl_efailed);
00974 }
00975 op=(int *)(pit->second.data);
00976 sz=pit->second.size;
00977 return gsl_success;
00978 }
00979 }
00980
00981
00982
00983
00984 return gsl_enotfound;
00985 }
00986
00987
00988 int geti(std::string name, int **&op, size_t &sz,
00989 size_t &sz2) {
00990 op=0;
00991 piter pit=plist.find(name);
00992 if (pit!=plist.end()) {
00993 if (((std::string)pit->second.iop->type())=="int") {
00994 if (pit->second.size==0 || pit->second.size2==0) {
00995 O2SCL_ERR_RET("Size of object incorrect in collection::get2().",
00996 gsl_efailed);
00997 }
00998 op=(int **)(pit->second.data);
00999 sz=pit->second.size;
01000 sz2=pit->second.size2;
01001 return gsl_success;
01002 }
01003 }
01004
01005
01006
01007
01008 return gsl_enotfound;
01009 }
01010
01011
01012 int gets(std::string name, std::string *&op, size_t &sz) {
01013 op=0;
01014 piter pit=plist.find(name);
01015 if (pit!=plist.end()) {
01016 if (((std::string)pit->second.iop->type())=="string") {
01017 if (pit->second.size==0 || pit->second.size2!=0) {
01018 O2SCL_ERR_RET("Size of object incorrect in collection::get2().",
01019 gsl_efailed);
01020 }
01021 op=(std::string *)(pit->second.data);
01022 sz=pit->second.size;
01023 return gsl_success;
01024 }
01025 }
01026
01027
01028
01029
01030 return gsl_enotfound;
01031 }
01032
01033
01034 int gets(std::string name, std::string **&op, size_t &sz,
01035 size_t &sz2) {
01036 op=0;
01037 piter pit=plist.find(name);
01038 if (pit!=plist.end()) {
01039 if (((std::string)pit->second.iop->type())=="string") {
01040 if (pit->second.size==0 || pit->second.size2==0) {
01041 O2SCL_ERR_RET("Size of object incorrect in collection::get2().",
01042 gsl_efailed);
01043 }
01044 op=(std::string **)(pit->second.data);
01045 sz=pit->second.size;
01046 sz2=pit->second.size2;
01047 return gsl_success;
01048 }
01049 }
01050
01051
01052
01053
01054 return gsl_enotfound;
01055 }
01056
01057
01058 int getw(std::string name, std::string *&op, size_t &sz) {
01059 op=0;
01060 piter pit=plist.find(name);
01061 if (pit!=plist.end()) {
01062 if (((std::string)pit->second.iop->type())=="word") {
01063 if (pit->second.size==0 || pit->second.size2!=0) {
01064 O2SCL_ERR_RET("Size of object incorrect in collection::get2().",
01065 gsl_efailed);
01066 }
01067 op=(std::string *)(pit->second.data);
01068 sz=pit->second.size;
01069 return gsl_success;
01070 }
01071 }
01072
01073
01074
01075
01076 return gsl_enotfound;
01077 }
01078
01079
01080 int getw(std::string name, std::string **&op, size_t &sz,
01081 size_t &sz2) {
01082 op=0;
01083 piter pit=plist.find(name);
01084 if (pit!=plist.end()) {
01085 if (((std::string)pit->second.iop->type())=="word") {
01086 if (pit->second.size==0 || pit->second.size2==0) {
01087 O2SCL_ERR_RET("Size of object incorrect in collection::get2().",
01088 gsl_efailed);
01089 }
01090 op=(std::string **)(pit->second.data);
01091 sz=pit->second.size;
01092 sz2=pit->second.size2;
01093 return gsl_success;
01094 }
01095 }
01096
01097
01098
01099
01100 return gsl_enotfound;
01101 }
01102
01103
01104
01105
01106
01107
01108
01109 template<class obj_t>
01110 int get(std::string name, obj_t *&op) {
01111 obj_t od;
01112 op=0;
01113 piter pit=plist.find(name);
01114 if (pit!=plist.end()) {
01115 if (((std::string)pit->second.iop->type())==od.type()) {
01116 if (pit->second.size!=0 || pit->second.size2!=0) {
01117 O2SCL_ERR_RET("Size of object incorrect in collection::get2().",
01118 gsl_efailed);
01119 }
01120 op=(obj_t *)(pit->second.data);
01121 return gsl_success;
01122 }
01123 }
01124
01125