irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

irods_re_serialization.cpp
Go to the documentation of this file.
1 
2 
3 
6 #include "rodsErrorTable.h"
7 #include "boost/lexical_cast.hpp"
8 
9 namespace irods {
10  namespace re_serialization {
11 
12  static void serialize_keyValPair(
13  const keyValPair_t& _kvp,
14  serialized_parameter_t& _out) {
15  if(_kvp.len > 0) {
16  for(int i = 0; i < _kvp.len; ++i) {
17  if(_kvp.keyWord && _kvp.keyWord[i]) {
18  if(_kvp.value && _kvp.value[i]) {
19  _out[_kvp.keyWord[i]] = _kvp.value[i];
20  }
21  else {
22  _out[_kvp.keyWord[i]] = "empty_value";
23  }
24  }
25  }
26  } else {
27  _out["keyValPair_t"] = "nullptr";
28  }
29  }
30 
32  boost::any _p,
33  serialized_parameter_t& _out) {
34  try {
35  float* f = boost::any_cast<float*>(_p);
36  _out["float_pointer"] = boost::lexical_cast<std::string>(*f);
37  }
38  catch ( std::exception& ) {
39  return ERROR(
41  "failed to cast float*" );
42  }
43 
44  return SUCCESS();
45  } // serialize_float_ptr
46 
48  boost::any _p,
49  serialized_parameter_t& _out) {
50  try {
51  const std::string* s = boost::any_cast<const std::string*>(_p);
52  _out["const_std_string_ptr"] = *s;
53  }
54  catch ( std::exception& ) {
55  return ERROR(
57  "failed to cast const_std_string*" );
58  }
59 
60  return SUCCESS();
61  } // serialize_const_std_string_ptr
62 
64  boost::any _p,
65  serialized_parameter_t& _out) {
66  try {
67  std::string* s = boost::any_cast<std::string*>(_p);
68  _out["std_string_ptr"] = *s;
69  }
70  catch ( std::exception& ) {
71  return ERROR(
73  "failed to cast std_string_ptr" );
74  }
75 
76  return SUCCESS();
77  } // serialize_std_string_ptr
78 
80  boost::any _p,
81  serialized_parameter_t& _out) {
82  try {
83  _out["std_string"] = boost::any_cast<std::string>(_p);
84  }
85  catch ( std::exception& ) {
86  return ERROR(
88  "failed to cast std_string*" );
89  }
90 
91  return SUCCESS();
92  } // serialize_std_string
93 
95  boost::any _p,
96  serialized_parameter_t& _out) {
97  try {
98  hierarchy_parser* p = boost::any_cast<hierarchy_parser*>(_p);
99  std::string hier;
100  p->str(hier);
101  _out["hierarchy_parser_ptr"] = hier;
102  }
103  catch ( std::exception& ) {
104  return ERROR(
106  "failed to cast hierarchy_parser_ptr*" );
107  }
108 
109  return SUCCESS();
110  } // serialize_hierarchy_parser_ptr
111 
113  boost::any _p,
114  serialized_parameter_t& _out) {
115  try {
116  rodsLong_t l = boost::any_cast<rodsLong_t>(_p);
117  _out["rodslong"] = boost::lexical_cast<std::string>(l);
118  }
119  catch ( std::exception& ) {
120  return ERROR(
122  "failed to cast rodslong" );
123  }
124 
125  return SUCCESS();
126  } // serialize_rodslong
127 
129  boost::any _p,
130  serialized_parameter_t& _out) {
131  try {
132  rodsLong_t* l = boost::any_cast<rodsLong_t*>(_p);
133  _out["rodslong_ptr"] = boost::lexical_cast<std::string>(*l);
134  }
135  catch ( std::exception& ) {
136  return ERROR(
138  "failed to cast rodslong" );
139  }
140 
141  return SUCCESS();
142  } // serialize_rodslong_ptr
143 
145  boost::any _p,
146  serialized_parameter_t& _out) {
147  try {
148  size_t l = boost::any_cast<size_t>(_p);
149  _out["sizet"] = boost::lexical_cast<std::string>(l);
150  }
151  catch ( std::exception& ) {
152  return ERROR(
154  "failed to cast sizet" );
155  }
156 
157  return SUCCESS();
158  } // serialize_sizet
159 
161  boost::any _p,
162  serialized_parameter_t& _out) {
163  try {
164  int l = boost::any_cast<int>(_p);
165  _out["int"] = boost::lexical_cast<std::string>(l);
166  }
167  catch ( std::exception& ) {
168  return ERROR(
170  "failed to cast int" );
171  }
172 
173  return SUCCESS();
174  } // serialize_int
175 
177  boost::any _p,
178  serialized_parameter_t& _out) {
179  try {
180  int* l = boost::any_cast<int*>(_p);
181  _out["int_ptr"] = boost::lexical_cast<std::string>(*l);
182  }
183  catch ( std::exception& ) {
184  return ERROR(
186  "failed to cast int ptr" );
187  }
188 
189  return SUCCESS();
190  } // serialize_rodslong_ptr
191 
193  boost::any _p,
194  serialized_parameter_t& _out) {
195  try {
196  char* l = boost::any_cast<char*>(_p);
197  if(l) {
198  _out["char_ptr"] = l;
199  }
200  else {
201  _out["char_ptr"] = "nullptr";
202  }
203  }
204  catch ( std::exception& ) {
205  return ERROR(
207  "failed to cast char ptr" );
208  }
209 
210  return SUCCESS();
211  } // serialize_char_ptr
212 
214  boost::any _p,
215  serialized_parameter_t& _out) {
216  try {
217  const char* l = boost::any_cast<const char*>(_p);
218  if(l) {
219  _out["const_char_ptr"] = l;
220  }
221  else {
222  _out["char_ptr"] = "nullptr";
223  }
224  }
225  catch ( std::exception& ) {
226  return ERROR(
228  "failed to cast const char ptr" );
229  }
230 
231  return SUCCESS();
232  } // serialize_const_char_ptr
233 
235  boost::any _p,
236  serialized_parameter_t& _out) {
237  try {
238  rsComm_t* l = boost::any_cast<rsComm_t*>(_p);
239  if (l) {
240  _out["client_addr"] = l->clientAddr;
241 
242  if(l->auth_scheme) {_out["auth_scheme"] = l->auth_scheme;}
243 
244  _out["proxy_user_name"] = l->proxyUser.userName;
245  _out["proxy_rods_zone"] = l->proxyUser.rodsZone;
246  _out["proxy_user_type"] = l->proxyUser.userType;
247  _out["proxy_sys_uid"] = boost::lexical_cast<std::string>(l->proxyUser.sysUid);
248  _out["proxy_auth_info_auth_scheme"] = l->proxyUser.authInfo.authScheme;
249  _out["proxy_auth_info_auth_flag"] = boost::lexical_cast<std::string>(l->proxyUser.authInfo.authFlag);
250  _out["proxy_auth_info_flag"] = boost::lexical_cast<std::string>(l->proxyUser.authInfo.flag);
251  _out["proxy_auth_info_ppid"] = boost::lexical_cast<std::string>(l->proxyUser.authInfo.ppid);
252  _out["proxy_auth_info_host"] = l->proxyUser.authInfo.host;
253  _out["proxy_auth_info_auth_str"] = l->proxyUser.authInfo.authStr;
254  _out["proxy_user_other_info_user_info"] = l->proxyUser.userOtherInfo.userInfo;
255  _out["proxy_user_other_info_user_comments"] = l->proxyUser.userOtherInfo.userComments;
256  _out["proxy_user_other_info_user_create"] = l->proxyUser.userOtherInfo.userCreate;
257  _out["proxy_user_other_info_user_modify"] = l->proxyUser.userOtherInfo.userModify;
258 
259  _out["user_user_name"] = l->clientUser.userName;
260  _out["user_rods_zone"] = l->clientUser.rodsZone;
261  _out["user_user_type"] = l->clientUser.userType;
262  _out["user_sys_uid"] = boost::lexical_cast<std::string>(l->clientUser.sysUid);
263  _out["user_auth_info_auth_scheme"] = l->clientUser.authInfo.authScheme;
264  _out["user_auth_info_auth_flag"] = boost::lexical_cast<std::string>(l->clientUser.authInfo.authFlag);
265  _out["user_auth_info_flag"] = boost::lexical_cast<std::string>(l->clientUser.authInfo.flag);
266  _out["user_auth_info_ppid"] = boost::lexical_cast<std::string>(l->clientUser.authInfo.ppid);
267  _out["user_auth_info_host"] = l->clientUser.authInfo.host;
268  _out["user_auth_info_auth_str"] = l->clientUser.authInfo.authStr;
269  _out["user_user_other_info_user_info"] = l->clientUser.userOtherInfo.userInfo;
270  _out["user_user_other_info_user_comments"] = l->clientUser.userOtherInfo.userComments;
271  _out["user_user_other_info_user_create"] = l->clientUser.userOtherInfo.userCreate;
272  _out["user_user_other_info_user_modify"] = l->clientUser.userOtherInfo.userModify;
273  } else {
274  _out["rsComm_ptr"] = "nullptr";
275  }
276  }
277  catch ( std::exception& ) {
278  return ERROR(
280  "failed to cast rsComm ptr" );
281  }
282 
283  return SUCCESS();
284  } // serialize_rsComm_ptr
285 
287  boost::any _p,
288  serialized_parameter_t& _out) {
289  try {
290  plugin_context l = boost::any_cast<plugin_context>(_p);
291  if( l.fco().get() ) {
292  l.fco()->get_re_vars( _out );
293  }
294 
295  if( l.comm() ) {
296  error ret = serialize_rsComm_ptr( l.comm(), _out );
297  if(!ret.ok()) {
298  return PASS(ret);
299  }
300  }
301  }
302  catch ( std::exception& ) {
303  return ERROR(
305  "failed to cast plugin_context" );
306  }
307 
308  return SUCCESS();
309  } // serialize_plugin_context
310 
312  specColl_t* _sc,
313  serialized_parameter_t& _out) {
314  if( _sc ) {
315  _out["coll_class"] = boost::lexical_cast<std::string>(_sc->collClass);
316  _out["type"] = boost::lexical_cast<std::string>(_sc->type);
317  _out["collection"] = _sc->collection;
318  _out["obj_path"] = _sc->objPath;
319  _out["resource"] = _sc->resource;
320  _out["resc_hier"] = _sc->rescHier;
321  _out["phy_path"] = _sc->phyPath;
322  _out["cache_dir"] = _sc->cacheDir;
323  try {
324  _out["cache_dirty"] = boost::lexical_cast<std::string>(_sc->cacheDirty);
325  }
326  catch( boost::bad_lexical_cast& ) {
327  _out["cache_dirty"] = "<unconvertable>";
328  }
329  try {
330  _out["repl_num"] = boost::lexical_cast<std::string>(_sc->replNum);
331  }
332  catch( boost::bad_lexical_cast& ) {
333  _out["repl_num"] = "<unconvertable>";
334  }
335  }
336  } // serialize_spec_coll_info_ptr
337 
339  boost::any _p,
340  serialized_parameter_t& _out) {
341  try {
342  dataObjInp_t* l = boost::any_cast<dataObjInp_t*>(_p);
343 
344  if (l) {
345  _out["obj_path"] = l->objPath;
346  _out["create_mode"] = boost::lexical_cast<std::string>(l->createMode);
347  _out["open_flags"] = boost::lexical_cast<std::string>(l->openFlags);
348  _out["offset"] = boost::lexical_cast<std::string>(l->offset);
349  _out["data_size"] = boost::lexical_cast<std::string>(l->dataSize);
350  _out["num_threads"] = boost::lexical_cast<std::string>(l->numThreads);
351  _out["opr_type"] = boost::lexical_cast<std::string>(l->oprType);
352  if(l->specColl) {
354  l->specColl,
355  _out );
356  }
357 
358  serialize_keyValPair(l->condInput, _out);
359 
360  } else {
361  _out["dataObjInp_ptr"] = "nullptr";
362  }
363  }
364  catch ( std::exception& ) {
365  return ERROR(
367  "failed to cast dataObjInp ptr" );
368  }
369 
370  return SUCCESS();
371  } // serialize_dataObjInp_ptr
372 
374  boost::any _p,
375  serialized_parameter_t& _out) {
376  try {
377  authResponseInp_t* l = boost::any_cast<authResponseInp_t*>(_p);
378  if (l) {
379  if(l->response) {
380  _out["response"] = l->response;
381  }
382  if(l->username) {
383  _out["username"] = l->username;
384  }
385  } else {
386  _out["authResponseInp_ptr"] = "nullptr";
387  }
388  }
389  catch ( std::exception& ) {
390  return ERROR(
392  "failed to cast authResponseInp*" );
393  }
394 
395  return SUCCESS();
396  } // serialize_authResponseInp_ptr
397 
399  boost::any _p,
400  serialized_parameter_t& _out) {
401  try {
402  dataObjInfo_t* l = boost::any_cast<dataObjInfo_t*>(_p);
403 
404  if (l) {
405  _out["logical_path"] = l->objPath;
406  _out["resc_hier"] = l->rescHier;
407  _out["data_type"] = l->dataType;
408  _out["data_size"] = boost::lexical_cast<std::string>(l->dataSize);
409  _out["checksum"] = l->chksum;
410  _out["version"] = l->version;
411  _out["physical_path"] = l->filePath;
412  _out["data_owner_name"] = l->dataOwnerName;
413  _out["data_owner_zone"] = l->dataOwnerZone;
414  _out["replica_number"] = boost::lexical_cast<std::string>(l->replNum);
415  _out["replica_status"] = boost::lexical_cast<std::string>(l->replStatus);
416  _out["data_id"] = boost::lexical_cast<std::string>(l->dataId);
417  _out["coll_id"] = boost::lexical_cast<std::string>(l->collId);
418  _out["data_map_id"] = boost::lexical_cast<std::string>(l->dataMapId);
419  _out["flags"] = boost::lexical_cast<std::string>(l->flags);
420  _out["data_comments"] = l->dataComments;
421  _out["data_mode"] = l->dataMode;
422  _out["data_expiry"] = l->dataExpiry;
423  _out["data_create"] = l->dataCreate;
424  _out["data_modify"] = l->dataModify;
425  _out["data_access"] = l->dataAccess;
426  _out["data_access_index"] = boost::lexical_cast<std::string>(l->dataAccessInx);
427  _out["write_flag"] = boost::lexical_cast<std::string>(l->writeFlag);
428  _out["dest_resc_name"] = l->destRescName;
429  _out["backup_resc_name"] = l->backupRescName;
430  _out["sub_path"] = l->subPath;
431  _out["reg_uid"] = boost::lexical_cast<std::string>(l->regUid);
432  _out["resc_id"] = l->rescId;
433 
434  if(l->specColl) {
436  l->specColl,
437  _out );
438  }
439 
440  serialize_keyValPair(l->condInput, _out);
441 
442  } else {
443  _out["dataObjInfo_ptr"] = "nullptr";
444  }
445  }
446  catch ( std::exception& ) {
447  return ERROR(
449  "failed to cast dataObjInfo ptr" );
450  }
451 
452  return SUCCESS();
453  } // serialize_dataObjInfo_ptr
454 
456  boost::any _p,
457  serialized_parameter_t& _out) {
458  try {
459  keyValPair_t* l = boost::any_cast<keyValPair_t*>(_p);
460 
461  if (l) {
462  for(int i = 0; i < l->len; ++i) {
463  _out[l->keyWord[i]] = l->value[i];
464  }
465  } else {
466  _out["keyValPair_ptr"] = "nullptr";
467  }
468 
469  }
470  catch ( std::exception& ) {
471  return ERROR(
473  "failed to cast keyValPair ptr" );
474  }
475 
476 
477  return SUCCESS();
478  } // serialize_keyValPair_ptr
479 
481  boost::any _p,
482  serialized_parameter_t& _out) {
483  try {
484  userInfo_t* l = boost::any_cast<userInfo_t*>(_p);
485 
486  if (l) {
487  _out["user_name"] = l->userName;
488  _out["rods_zone"] = l->rodsZone;
489  _out["user_type"] = l->userType;
490  _out["sys_uid"] = boost::lexical_cast<std::string>(l->sysUid);
491  _out["auth_info_auth_scheme"] = l->authInfo.authScheme;
492  _out["auth_info_auth_flag"] = boost::lexical_cast<std::string>(l->authInfo.authFlag);
493  _out["auth_info_flag"] = boost::lexical_cast<std::string>(l->authInfo.flag);
494  _out["auth_info_ppid"] = boost::lexical_cast<std::string>(l->authInfo.ppid);
495  _out["auth_info_host"] = l->authInfo.host;
496  _out["auth_info_auth_str"] = l->authInfo.authStr;
497  _out["user_other_info_user_info"] = l->userOtherInfo.userInfo;
498  _out["user_other_info_user_comments"] = l->userOtherInfo.userComments;
499  _out["user_other_info_user_create"] = l->userOtherInfo.userCreate;
500  _out["user_other_info_user_modify"] = l->userOtherInfo.userModify;
501  } else {
502  _out["userInfo_ptr"] = "nullptr";
503  }
504  }
505  catch ( std::exception& ) {
506  return ERROR(
508  "failed to cast userInfo ptr" );
509  }
510 
511 
512  return SUCCESS();
513  } // serialize_userInfo_ptr
514 
516  boost::any _p,
517  serialized_parameter_t& _out) {
518  try {
519  collInfo_t* l = boost::any_cast<collInfo_t*>(_p);
520 
521  if (l) {
522  _out["coll_id"] = boost::lexical_cast<std::string>(l->collId);
523  _out["coll_name"] = l->collName;
524  _out["coll_parent_name"] = l->collParentName;
525  _out["coll_owner_name"] = l->collOwnerName;
526  _out["coll_owner_zone"] = l->collOwnerZone;
527  _out["coll_map_id"] = boost::lexical_cast<std::string>(l->collMapId);
528  _out["coll_access_index"] = boost::lexical_cast<std::string>(l->collAccessInx);
529  _out["coll_comments"] = l->collComments;
530  _out["coll_inheritance"] = l->collInheritance;
531  _out["coll_expiry"] = l->collExpiry;
532  _out["coll_create"] = l->collCreate;
533  _out["coll_modify"] = l->collModify;
534  _out["coll_access"] = l->collAccess;
535  _out["coll_type"] = l->collType;
536  _out["coll_info1"] = l->collInfo1;
537  _out["coll_info2"] = l->collInfo2;
538 
539  serialize_keyValPair(l->condInput, _out);
540 
541  } else {
542  _out["collInfo_ptr"] = "nullptr";
543  }
544  }
545  catch ( std::exception& ) {
546  return ERROR(
548  "failed to cast collInfo ptr" );
549  }
550 
551  return SUCCESS();
552  } // serialize_collInfo_ptr
553 
555  boost::any _p,
556  serialized_parameter_t& _out) {
557  try {
558  collInp_t* l = boost::any_cast<collInp_t*>(_p);
559 
560  if (l) {
561  _out["coll_name"] = l->collName;
562  _out["flags"] = l->flags;
563  _out["opr_type"] = l->oprType;
564 
565  serialize_keyValPair(l->condInput, _out);
566 
567  } else {
568  _out["collInp_ptr"] = "nullptr";
569  }
570  }
571  catch ( std::exception& ) {
572  return ERROR(
574  "failed to cast collInp ptr" );
575  }
576 
577  return SUCCESS();
578  } // serialize_collInp_ptr
579 
581  boost::any _p,
582  serialized_parameter_t& _out) {
583  try {
584  modAVUMetadataInp_t* l = boost::any_cast<modAVUMetadataInp_t*>(_p);
585 
586  if (l) {
587  if( l->arg0 ) { _out["arg0"] = l->arg0; }
588  if( l->arg1 ) { _out["arg1"] = l->arg1; }
589  if( l->arg2 ) { _out["arg2"] = l->arg2; }
590  if( l->arg3 ) { _out["arg3"] = l->arg3; }
591  if( l->arg4 ) { _out["arg4"] = l->arg4; }
592  if( l->arg5 ) { _out["arg5"] = l->arg5; }
593  if( l->arg6 ) { _out["arg6"] = l->arg6; }
594  if( l->arg7 ) { _out["arg7"] = l->arg7; }
595  if( l->arg8 ) { _out["arg8"] = l->arg8; }
596  if( l->arg9 ) { _out["arg9"] = l->arg9; }
597  } else {
598  _out["modAVUMetaInp_ptr"] = "nullptr";
599  }
600  }
601  catch ( std::exception& ) {
602  return ERROR(
604  "failed to cast modAVUMetaInp ptr" );
605  }
606 
607  return SUCCESS();
608  } // serialize_modAVUMetaInp_ptr
609 
611  boost::any _p,
612  serialized_parameter_t& _out) {
613  try {
614  modAccessControlInp_t* l = boost::any_cast<modAccessControlInp_t*>(_p);
615 
616  if (l) {
617  _out["recursive_flag"] = boost::lexical_cast<std::string>(l->recursiveFlag);
618  if( l->accessLevel ) { _out["access_level"] = l->accessLevel; }
619  if( l->userName ) { _out["user_name"] = l->userName; }
620  if( l->zone ) { _out["zone"] = l->zone; }
621  if( l->path ) { _out["path"] = l->path; }
622  } else {
623  _out["modAccessControlInp_ptr"] = "nullptr";
624  }
625  }
626  catch ( std::exception& ) {
627  return ERROR(
629  "failed to cast modAccessControlInp ptr" );
630  }
631 
632  return SUCCESS();
633  } // serialize_modAccessControlInp_ptr
634 
636  boost::any _p,
637  serialized_parameter_t& _out) {
638  try {
639  modDataObjMeta_t* l = boost::any_cast<modDataObjMeta_t*>(_p);
640 
641  if (l) {
643  l->dataObjInfo,
644  _out);
645  if(!ret.ok()) {
646  irods::log(PASS(ret));
647  }
648 
649  if( l->regParam ) {
650  for(int i = 0; i < l->regParam->len; ++i) {
651  _out[l->regParam->keyWord[i]] = l->regParam->value[i];
652  }
653  }
654  } else {
655  _out["modDataObjMeta_ptr"] = "nullptr";
656  }
657  }
658  catch ( std::exception& ) {
659  return ERROR(
661  "failed to cast modDataObjMeta ptr" );
662  }
663 
664  return SUCCESS();
665  } // serialize_modDataObjMeta_ptr
666 
668  boost::any _p,
669  serialized_parameter_t& _out) {
670  try {
671  ruleExecSubmitInp_t* l = boost::any_cast<ruleExecSubmitInp_t*>(_p);
672 
673  if (l) {
674  _out["rule_name"] = l->ruleName;
675  _out["rei_file_path"] = l->reiFilePath;
676  _out["user_name"] = l->userName;
677  _out["exe_address"] = l->exeAddress;
678  _out["exe_time"] = l->exeTime;
679  _out["exe_frequency"] = l->exeFrequency;
680  _out["priority"] = l->priority;
681  _out["last_exec_time"] = l->lastExecTime;
682  _out["exe_status"] = l->exeStatus;
683  _out["estimate_exe_time"] = l->estimateExeTime;
684  _out["notification_addr"] = l->notificationAddr;
685  _out["rule_exec_id"] = l->ruleExecId;
686 
687  for(int i = 0; i < l->condInput.len; ++i) {
688  _out[l->condInput.keyWord[i]] = l->condInput.value[i];
689  }
690  } else {
691  _out["ruleExecSubmitInp_ptr"] = "nullptr";
692  }
693  }
694  catch ( std::exception& ) {
695  return ERROR(
697  "failed to cast ruleExecSubmitInp ptr" );
698  }
699 
700  return SUCCESS();
701  } // serialize_ruleExecSubmitInp_ptr
702 
704  boost::any _p,
705  serialized_parameter_t& _out) {
706  try {
707  dataObjCopyInp_t* l = boost::any_cast<dataObjCopyInp_t*>(_p);
708 
709  if (l) {
712  &l->srcDataObjInp,
713  src );
714  if(!ret.ok()) {
715  irods::log(PASS(ret));
716  }
717  else {
718  for( auto p : src ) {
719  _out["src_"+p.first] = p.second;
720  }
721  }
722 
723 
726  &l->destDataObjInp,
727  dst );
728  if(!ret.ok()) {
729  irods::log(PASS(ret));
730  }
731  else {
732  for( auto p : dst ) {
733  _out["dst_"+p.first] = p.second;
734  }
735  }
736  } else {
737  _out["dataObjCopyInp_ptr"] = "nullptr";
738  }
739  }
740  catch ( std::exception& ) {
741  return ERROR(
743  "failed to cast dataObjCopyInp ptr" );
744  }
745 
746  return SUCCESS();
747  } // serialize_dataObjCopyInp_ptr
748 
750  boost::any _p,
751  serialized_parameter_t& _out) {
752  try {
753  rodsObjStat_t** tmp = boost::any_cast<rodsObjStat_t**>(_p);
754  if(tmp && *tmp) {
755  rodsObjStat_t* l = *tmp;
756 
757  _out["obj_size"] = boost::lexical_cast<std::string>(l->objSize);
758  _out["obj_type"] = boost::lexical_cast<std::string>((int)l->objType);
759  _out["data_mode"] = boost::lexical_cast<std::string>(l->dataMode);
760 
761  _out["data_id"] = boost::lexical_cast<std::string>(l->dataId);
762  _out["checksum"] = boost::lexical_cast<std::string>(l->chksum);
763  _out["ownerName"] = boost::lexical_cast<std::string>(l->ownerName);
764  _out["owner_zone"] = boost::lexical_cast<std::string>(l->ownerZone);
765  _out["create_time"] = boost::lexical_cast<std::string>(l->createTime);
766  _out["modify_time"] = boost::lexical_cast<std::string>(l->modifyTime);
767  _out["resc_hier"] = boost::lexical_cast<std::string>(l->rescHier);
768 
769  if(l->specColl) {
771  l->specColl,
772  _out );
773  }
774  }
775  else {
776  _out["null_value"] = "null_value";
777  }
778  }
779  catch ( std::exception& ) {
780  return ERROR(
782  "failed to cast rodsObjStat ptr ptr" );
783  }
784 
785  return SUCCESS();
786  } // serialize_rodsObjStat_ptr_ptr
787 
789  boost::any _p,
790  serialized_parameter_t& _out) {
791  try {
792  rodsObjStat_t* tmp = boost::any_cast<rodsObjStat_t*>(_p);
793  if(tmp) {
794  rodsObjStat_t* l = tmp;
795 
796  _out["obj_size"] = boost::lexical_cast<std::string>(l->objSize);
797  _out["obj_type"] = boost::lexical_cast<std::string>((int)l->objType);
798  _out["data_mode"] = boost::lexical_cast<std::string>(l->dataMode);
799 
800  _out["data_id"] = boost::lexical_cast<std::string>(l->dataId);
801  _out["checksum"] = boost::lexical_cast<std::string>(l->chksum);
802  _out["ownerName"] = boost::lexical_cast<std::string>(l->ownerName);
803  _out["owner_zone"] = boost::lexical_cast<std::string>(l->ownerZone);
804  _out["create_time"] = boost::lexical_cast<std::string>(l->createTime);
805  _out["modify_time"] = boost::lexical_cast<std::string>(l->modifyTime);
806  _out["resc_hier"] = boost::lexical_cast<std::string>(l->rescHier);
807 
808  if(l->specColl) {
810  l->specColl,
811  _out );
812  }
813  }
814  else {
815  _out["null_value"] = "null_value";
816  }
817  }
818  catch ( std::exception& ) {
819  return ERROR(
821  "failed to cast rodsObjStat ptr" );
822  }
823 
824  return SUCCESS();
825  } // serialize_rodsObjStat_ptr
826 
828  boost::any _p,
829  serialized_parameter_t& _out) {
830  try {
831  genQueryInp_t* tmp = boost::any_cast<genQueryInp_t*>(_p);
832  if(tmp) {
833  genQueryInp_t* l = tmp;
834 
835  _out["maxRows"] = boost::lexical_cast<std::string>(l->maxRows);
836  _out["continueInx"] = boost::lexical_cast<std::string>(l->continueInx);
837  _out["rowOffset"] = boost::lexical_cast<std::string>(l->rowOffset);
838  _out["options"] = boost::lexical_cast<std::string>(l->options);
839 
840  for(int i = 0; i < l->condInput.len; ++i) {
841  _out[l->condInput.keyWord[i]] = l->condInput.value[i];
842  }
843 
844  for (int i = 0; i < l->selectInp.len; ++i) {
845  std::string index = boost::lexical_cast<std::string>(l->selectInp.inx[i]);
846 
847  std::string value = boost::lexical_cast<std::string>(l->selectInp.value[i]);
848  _out["select_" + index] = value;
849  }
850 
851  for (int i = 0; i < l->sqlCondInp.len; ++i) {
852  std::string index = boost::lexical_cast<std::string>(l->sqlCondInp.inx[i]);
853 
854  _out["where_" + index] = l->sqlCondInp.value[i];
855  }
856  }
857  else {
858  _out["null_value"] = "null_value";
859  }
860  }
861  catch ( std::exception& ) {
862  return ERROR(
864  "failed to cast genQueryInp ptr" );
865  }
866 
867  return SUCCESS();
868  } // serialize_genQueryInp_ptr
869 
871  boost::any _p,
872  serialized_parameter_t& _out) {
873  try {
874  genQueryOut_t* tmp = boost::any_cast<genQueryOut_t*>(_p);
875  if (tmp) {
876  genQueryOut_t* l = tmp;
877 
878  _out["rowCnt"] = boost::lexical_cast<std::string>(l->rowCnt);
879  _out["attriCnt"] = boost::lexical_cast<std::string>(l->attriCnt);
880  _out["continueInx"] = boost::lexical_cast<std::string>(l->continueInx);
881  _out["totalRowCount"] = boost::lexical_cast<std::string>(l->totalRowCount);
882 
883  for (int i = 0; i < l->attriCnt; ++i) {
884  for (int j = 0; j < l->rowCnt; ++j) {
885  std::string i_str = boost::lexical_cast<std::string>(i);
886  std::string j_str = boost::lexical_cast<std::string>(j);
887  _out["attriInx_" + i_str] = boost::lexical_cast<std::string>(l->sqlResult[i].attriInx);
888  _out["len_" + i_str] = boost::lexical_cast<std::string>(l->sqlResult[i].len);
889  _out["value_" + j_str + "_" + i_str] = boost::lexical_cast<std::string>(l->sqlResult[i].value+j*l->sqlResult[i].len);
890  }
891  }
892  } else {
893  _out["null_value"] = "null_value";
894  }
895  } catch ( std::exception& ) {
896  return ERROR(
898  "failed to cast genQueryOut ptr" );
899  }
900 
901  return SUCCESS();
902  } //serialize_genQueryOut_ptr
903 
904 
906  boost::any _p,
907  serialized_parameter_t& _out) {
908  try {
909  char** tmp = boost::any_cast<char**>(_p);
910  if(tmp && *tmp ) {
911  _out["value"] = *tmp;
912  }
913  else {
914  _out["null_value"] = "null_value";
915  }
916  }
917  catch ( std::exception& ) {
918  return ERROR(
920  "failed to cast char ptr ptr" );
921  }
922 
923  return SUCCESS();
924  } // serialize_char_ptr_ptr
925 #if 0
926  static error serialize_XXXX_ptr(
927  boost::any _p,
928  serialized_parameter_t& _out) {
929  try {
930  XXXX_t* l = boost::any_cast<XXXX_t*>(_p);
931  }
932  catch ( std::exception& ) {
933  return ERROR(
935  "failed to cast XXXX ptr" );
936  }
937 
938  return SUCCESS();
939  } // serialize_XXXX_ptr
940 #endif
941 
943  static serialization_map_t the_map {
944  { std::type_index(typeid(float*)), serialize_float_ptr },
945  { std::type_index(typeid(const std::string*)), serialize_const_std_string_ptr },
946  { std::type_index(typeid(std::string*)), serialize_std_string_ptr },
947  { std::type_index(typeid(std::string)), serialize_std_string },
948  { std::type_index(typeid(hierarchy_parser*)), serialize_hierarchy_parser_ptr },
949  { std::type_index(typeid(rodsLong_t)), serialize_rodslong },
950  { std::type_index(typeid(rodsLong_t*)), serialize_rodslong_ptr },
951  { std::type_index(typeid(size_t)), serialize_sizet },
952  { std::type_index(typeid(int)), serialize_int },
953  { std::type_index(typeid(int*)), serialize_int_ptr },
954  { std::type_index(typeid(char*)), serialize_char_ptr },
955  { std::type_index(typeid(const char*)), serialize_const_char_ptr },
956  { std::type_index(typeid(rsComm_t*)), serialize_rsComm_ptr },
957  { std::type_index(typeid(plugin_context)), serialize_plugin_context },
958  { std::type_index(typeid(dataObjInp_t*)), serialize_dataObjInp_ptr },
959  { std::type_index(typeid(authResponseInp_t*)), serialize_authResponseInp_ptr },
960  { std::type_index(typeid(dataObjInfo_t*)), serialize_dataObjInfo_ptr },
961  { std::type_index(typeid(keyValPair_t*)), serialize_keyValPair_ptr },
962  { std::type_index(typeid(userInfo_t*)), serialize_userInfo_ptr },
963  { std::type_index(typeid(collInfo_t*)), serialize_collInfo_ptr },
964  { std::type_index(typeid(collInp_t*)), serialize_collInp_ptr },
965  { std::type_index(typeid(modAVUMetadataInp_t*)), serialize_modAVUMetaInp_ptr },
966  { std::type_index(typeid(modAccessControlInp_t*)), serialize_modAccessControlInp_ptr },
967  { std::type_index(typeid(modDataObjMeta_t*)), serialize_modDataObjMeta_ptr },
968  { std::type_index(typeid(ruleExecSubmitInp_t*)), serialize_ruleExecSubmitInp_ptr },
969  { std::type_index(typeid(dataObjCopyInp_t*)), serialize_dataObjCopyInp_ptr },
970  { std::type_index(typeid(rodsObjStat_t**)), serialize_rodsObjStat_ptr_ptr },
971  { std::type_index(typeid(rodsObjStat_t*)), serialize_rodsObjStat_ptr },
972  { std::type_index(typeid(genQueryInp_t*)), serialize_genQueryInp_ptr },
973  { std::type_index(typeid(genQueryOut_t*)), serialize_genQueryOut_ptr },
974  { std::type_index(typeid(char**)), serialize_char_ptr_ptr }
975  };
976  return the_map;
977 
978  } // get_serialization_map
979 
981  const index_t& _index,
982  operation_t _operation ) {
983 
985  if(the_map.find(_index) != the_map.end() ) {
986  return ERROR(
988  "type_index exists");
989  }
990 
991  the_map[ _index ] = _operation;
992 
993  return SUCCESS();
994 
995  } // add_operation
996 
997  static std::string demangle(const char* name) {
998  int status = -4; // some arbitrary value to eliminate the compiler warning
999  std::unique_ptr<char, void(*)(void*)> res {
1000  abi::__cxa_demangle(name, NULL, NULL, &status),
1001  std::free
1002  };
1003  return (status==0) ? res.get() : name ;
1004  }
1005 
1007  boost::any _in_param,
1008  serialized_parameter_t& _out_param ) {
1009  index_t idx = std::type_index(_in_param.type());
1011  if(the_map.find(idx) == the_map.end() ) {
1012  std::string err = "[";
1013  err += demangle( _in_param.type().name() );
1014  err += "] not supported";
1015  _out_param["ERROR"] = err;
1016  return SUCCESS();
1017  }
1018 
1019  return the_map[idx](_in_param, _out_param);
1020 
1021  } // serialize_parameter
1022 
1023  }; // re_serialization
1024 
1025 }; // namespace irods
1026 
1027 
1028 
NULL
#define NULL
Definition: rodsDef.h:70
rsComm_t
Definition: rcConnect.h:145
irods::re_serialization::serialized_parameter_t
std::map< std::string, std::string > serialized_parameter_t
Definition: irods_re_serialization.hpp:21
irods::re_serialization::serialize_int_ptr
static error serialize_int_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:176
DataObjCopyInp
Definition: dataObjCopy.h:25
CollInp
Definition: dataObjInpOut.h:157
irods::re_serialization::serialize_collInp_ptr
static error serialize_collInp_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:554
userInfo_t
Definition: rodsUser.h:65
SpecColl::resource
char resource[64]
Definition: objInfo.h:83
PASS
#define PASS(prev_error_)
Definition: irods_error.hpp:118
irods::re_serialization::serialize_hierarchy_parser_ptr
static error serialize_hierarchy_parser_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:94
irods::re_serialization::index_t
std::type_index index_t
Definition: irods_re_serialization.hpp:20
irods::re_serialization::serialize_authResponseInp_ptr
static error serialize_authResponseInp_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:373
irods_re_serialization.hpp
GenQueryInp
Definition: rodsGenQuery.h:24
irods::re_serialization::serialize_rsComm_ptr
static error serialize_rsComm_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:234
irods::re_serialization::serialize_genQueryOut_ptr
static error serialize_genQueryOut_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:870
SpecColl::cacheDirty
int cacheDirty
Definition: objInfo.h:92
irods::re_serialization::serialize_sizet
static error serialize_sizet(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:144
SpecColl::phyPath
char phyPath[(1024+64)]
Definition: objInfo.h:85
irods::re_serialization::serialize_std_string_ptr
static error serialize_std_string_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:63
irods::hierarchy_parser
Definition: irods_hierarchy_parser.hpp:14
irods_plugin_context.hpp
pid_age.p
p
Definition: pid_age.py:13
irods::re_serialization::serialize_keyValPair_ptr
static error serialize_keyValPair_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:455
SpecColl::cacheDir
char cacheDir[(1024+64)]
Definition: objInfo.h:89
SpecColl::type
structFileType_t type
Definition: objInfo.h:78
irods::re_serialization::serialize_modAVUMetaInp_ptr
static error serialize_modAVUMetaInp_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:580
SpecColl::replNum
int replNum
Definition: objInfo.h:93
SpecColl
Definition: objInfo.h:76
irods::re_serialization::serialize_rodsObjStat_ptr_ptr
static error serialize_rodsObjStat_ptr_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:749
irods::re_serialization::operation_t
std::function< error(boost::any, serialized_parameter_t &)> operation_t
Definition: irods_re_serialization.hpp:22
irods::plugin_context
Definition: irods_plugin_context.hpp:18
irods::re_serialization::serialize_dataObjCopyInp_ptr
static error serialize_dataObjCopyInp_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:703
generate_iadmin_commands_for_41_to_42_upgrade.name
name
Definition: generate_iadmin_commands_for_41_to_42_upgrade.py:23
modAccessControlInp_t
Definition: modAccessControl.h:9
irods::re_serialization::serialize_spec_coll_info_ptr
static void serialize_spec_coll_info_ptr(specColl_t *_sc, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:311
CollInfo
Definition: objInfo.h:177
KeyValPair::value
char ** value
Definition: objInfo.h:123
SUCCESS
#define SUCCESS()
Definition: irods_error.hpp:121
irods
Definition: apiHandler.hpp:35
irods::re_serialization::add_operation
error add_operation(const index_t &_index, operation_t _operation)
Definition: irods_re_serialization.cpp:980
authResponseInp_t
Definition: authResponse.h:6
irods::re_serialization::serialize_keyValPair
static void serialize_keyValPair(const keyValPair_t &_kvp, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:12
KeyValPair::keyWord
char ** keyWord
Definition: objInfo.h:122
irods::re_serialization::serialize_const_char_ptr
static error serialize_const_char_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:213
DataObjInp
Definition: dataObjInpOut.h:65
irods::re_serialization::serialization_map_t
std::map< index_t, operation_t > serialization_map_t
Definition: irods_re_serialization.hpp:23
irods::re_serialization::serialize_collInfo_ptr
static error serialize_collInfo_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:515
INVALID_ANY_CAST
@ INVALID_ANY_CAST
Definition: rodsErrorTable.h:771
KEY_NOT_FOUND
@ KEY_NOT_FOUND
Definition: rodsErrorTable.h:749
irods::re_serialization::serialize_modDataObjMeta_ptr
static error serialize_modDataObjMeta_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:635
GenQueryOut
Definition: rodsGenQuery.h:67
irods::re_serialization::serialize_int
static error serialize_int(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:160
irods::re_serialization::serialize_rodslong_ptr
static error serialize_rodslong_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:128
get_irods_version.value
dictionary value
Definition: get_irods_version.py:27
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
SpecColl::rescHier
char rescHier[(1024+64)]
Definition: objInfo.h:84
irods::re_serialization::serialize_userInfo_ptr
static error serialize_userInfo_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:480
irods::log
void log(const error &)
Definition: irods_log.cpp:13
modAVUMetadataInp_t
Definition: modAVUMetadata.h:6
ERROR
#define ERROR(code_, message_)
Definition: irods_error.hpp:117
irods::re_serialization::serialize_float_ptr
static error serialize_float_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:31
irods::re_serialization::serialize_parameter
error serialize_parameter(boost::any _in_param, serialized_parameter_t &_out_param)
Definition: irods_re_serialization.cpp:1006
irods::error
Definition: irods_error.hpp:23
irods::re_serialization::serialize_dataObjInfo_ptr
static error serialize_dataObjInfo_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:398
ruleExecSubmitInp_t
Definition: ruleExecSubmit.h:21
SpecColl::collection
char collection[(1024+64)]
Definition: objInfo.h:79
get_db_schema_version.l
l
Definition: get_db_schema_version.py:19
irods::re_serialization::serialize_char_ptr
static error serialize_char_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:192
irods::re_serialization::get_serialization_map
serialization_map_t & get_serialization_map()
Definition: irods_re_serialization.cpp:942
irods::re_serialization::serialize_ruleExecSubmitInp_ptr
static error serialize_ruleExecSubmitInp_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:667
KeyValPair::len
int len
Definition: objInfo.h:121
irods::re_serialization::serialize_rodslong
static error serialize_rodslong(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:112
irods::re_serialization::serialize_plugin_context
static error serialize_plugin_context(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:286
rodsObjStat
Definition: objStat.h:8
rodsErrorTable.h
irods::re_serialization::serialize_std_string
static error serialize_std_string(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:79
irods::re_serialization::serialize_dataObjInp_ptr
static error serialize_dataObjInp_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:338
modDataObjMeta_t
Definition: modDataObjMeta.h:7
irods::re_serialization::serialize_modAccessControlInp_ptr
static error serialize_modAccessControlInp_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:610
KeyValPair
Definition: objInfo.h:120
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
SpecColl::objPath
char objPath[(1024+64)]
Definition: objInfo.h:80
irods::re_serialization::serialize_genQueryInp_ptr
static error serialize_genQueryInp_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:827
DataObjInfo
Definition: objInfo.h:129
irods::re_serialization::serialize_const_std_string_ptr
static error serialize_const_std_string_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:47
irods::re_serialization::serialize_char_ptr_ptr
static error serialize_char_ptr_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:905
irods::re_serialization::demangle
static std::string demangle(const char *name)
Definition: irods_re_serialization.cpp:997
irods::re_serialization::serialize_rodsObjStat_ptr
static error serialize_rodsObjStat_ptr(boost::any _p, serialized_parameter_t &_out)
Definition: irods_re_serialization.cpp:788
rodsLong_t
long long rodsLong_t
Definition: rodsType.h:32
SpecColl::collClass
specCollClass_t collClass
Definition: objInfo.h:77