FACT++  1.0
template<typename T >
bool fits::SetPtrAddress ( const std::string &  name,
T *  ptr,
size_t  cnt 
)
inline

Definition at line 911 of file fits.h.

References fits::Table::cols, and str.

912  {
913  if (fTable.cols.count(name)==0)
914  {
915  std::ostringstream str;
916  str << "SetPtrAddress('" << name << "') - Column not found.";
917  Exception(str.str());
918  return false;
919  }
920 
921  if (sizeof(T)!=fTable.cols[name].size)
922  {
923  std::ostringstream str;
924  str << "SetPtrAddress('" << name << "') - Element size mismatch: expected "
925  << fTable.cols[name].size << " from header, got " << sizeof(T);
926  Exception(str.str());
927  return false;
928  }
929 
930  if (cnt!=fTable.cols[name].num)
931  {
932  std::ostringstream str;
933  str << "SetPtrAddress('" << name << "') - Element count mismatch: expected "
934  << fTable.cols[name].num << " from header, got " << cnt;
935  Exception(str.str());
936  return false;
937  }
938 
939  // if (fAddresses.count(ptr)>0)
940  // gLog << warn << "SetPtrAddress('" << name << "') - Pointer " << ptr << " already assigned." << endl;
941 
942  //fAddresses[ptr] = fTable.cols[name];
943  fPointers[name] = ptr;
944  fAddresses.emplace_back(ptr, fTable.cols[name]);
945  sort(fAddresses.begin(), fAddresses.end(), Compare);
946  return true;
947  }
char str[80]
Definition: test_client.c:7
static bool Compare(const Address &p1, const Address &p2)
Definition: fits.h:862
Columns cols
Definition: fits.h:116
Table fTable
Definition: fits.h:502
Pointers fPointers
Definition: fits.h:507
void Exception(const std::string &txt)
Definition: fits.h:484
Addresses fAddresses
Definition: fits.h:505