Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-05 22:48:10

0001 // -*- C++ -*-
0002 //
0003 // Package:     Core
0004 // Class  :     FWItemSingleAccessor
0005 //
0006 // Implementation:
0007 //     <Notes on implementation>
0008 //
0009 // Original Author:  Chris Jones
0010 //         Created:  Sat Oct 18 11:36:44 EDT 2008
0011 //
0012 
0013 // system include files
0014 #include <cassert>
0015 #include "FWCore/Reflection/interface/ObjectWithDict.h"
0016 #include "FWCore/Reflection/interface/TypeWithDict.h"
0017 
0018 // user include files
0019 #include "Fireworks/Core/interface/FWItemSingleAccessor.h"
0020 
0021 //
0022 // constants, enums and typedefs
0023 //
0024 
0025 //
0026 // static data member definitions
0027 //
0028 
0029 //
0030 // constructors and destructor
0031 //
0032 FWItemSingleAccessor::FWItemSingleAccessor(const TClass* iClass) : m_type(iClass), m_data(nullptr) {}
0033 
0034 // FWItemSingleAccessor::FWItemSingleAccessor(const FWItemSingleAccessor& rhs)
0035 // {
0036 //    // do actual copying here;
0037 // }
0038 
0039 FWItemSingleAccessor::~FWItemSingleAccessor() {}
0040 
0041 //
0042 // assignment operators
0043 //
0044 // const FWItemSingleAccessor& FWItemSingleAccessor::operator=(const FWItemSingleAccessor& rhs)
0045 // {
0046 //   //An exception safe implementation is
0047 //   FWItemSingleAccessor temp(rhs);
0048 //   swap(rhs);
0049 //
0050 //   return *this;
0051 // }
0052 
0053 //
0054 // member functions
0055 //
0056 void FWItemSingleAccessor::setData(const edm::ObjectWithDict& product) {
0057   if (product.address() == nullptr) {
0058     reset();
0059     return;
0060   }
0061 
0062   m_data = product.address();
0063   assert(nullptr != m_data);
0064 }
0065 
0066 void FWItemSingleAccessor::reset() { m_data = nullptr; }
0067 
0068 //
0069 // const member functions
0070 //
0071 const void* FWItemSingleAccessor::modelData(int iIndex) const {
0072   if (0 == iIndex) {
0073     return m_data;
0074   }
0075   return nullptr;
0076 }
0077 
0078 const void* FWItemSingleAccessor::data() const { return m_data; }
0079 
0080 unsigned int FWItemSingleAccessor::size() const { return nullptr == m_data ? 0 : 1; }
0081 
0082 const TClass* FWItemSingleAccessor::modelType() const { return m_type; }
0083 
0084 const TClass* FWItemSingleAccessor::type() const { return m_type; }
0085 
0086 bool FWItemSingleAccessor::isCollection() const { return false; }
0087 
0088 //
0089 // static member functions
0090 //