Skip to content

Commit

Permalink
Refs #6449 Fixing Unix compiler issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
abuts committed Apr 17, 2013
1 parent 931b586 commit 7727efd
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 26 deletions.
8 changes: 4 additions & 4 deletions Code/Mantid/Framework/Kernel/inc/MantidKernel/DiskBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <map>
#include <stdint.h>
#include <vector>
#include <forward_list>
#include <list>

namespace Mantid
{
Expand Down Expand Up @@ -77,9 +77,9 @@ namespace Kernel
DiskBuffer(uint64_t m_writeBufferSize);
virtual ~DiskBuffer();

void toWrite(ISaveable * const item);
void toWrite(ISaveable * item);
void flushCache();
void objectDeleted(ISaveable *const item);
void objectDeleted(ISaveable * item);

// Free space map methods
void freeBlock(uint64_t const pos, uint64_t const fileSize);
Expand Down Expand Up @@ -143,7 +143,7 @@ namespace Kernel
/// number of objects stored in to write buffer list
size_t m_nObjectsToWrite;
/** A forward list for the buffer of "toWrite" objects. */
std::list<ISaveable * const> m_toWriteBuffer;
std::list<ISaveable * > m_toWriteBuffer;

/// Mutex for modifying the the toWrite buffer.
Kernel::Mutex m_mutex;
Expand Down
6 changes: 3 additions & 3 deletions Code/Mantid/Framework/Kernel/inc/MantidKernel/ISaveable.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ namespace Kernel
Kernel::Mutex m_setter;
private:
// the iterator which describes the position of this object in the DiskBuffer. Undefined if not placed to buffer
boost::optional< std::list<ISaveable * const >::iterator> m_BufPosition;
boost::optional< std::list<ISaveable * >::iterator> m_BufPosition;
// the size of the object in the memory buffer, used to calculate the total amount of memory the objects occupy
size_t m_BufMemorySize;

Expand All @@ -120,9 +120,9 @@ namespace Kernel
void saveAt(uint64_t newPos, uint64_t newSize);

/// sets the iterator pointing to the location of this object in the memory buffer to write later
size_t setBufferPosition(std::list<ISaveable *const >::iterator &bufPosition);
size_t setBufferPosition(std::list<ISaveable * >::iterator bufPosition);
/// returns the iterator pointing to the position of this object within the memory to-write buffer
boost::optional<std::list<ISaveable *const>::iterator > & getBufPostion()
boost::optional<std::list<ISaveable *>::iterator > & getBufPostion()
{return m_BufPosition;}
/// return the amount of memory, this object had when it was stored in buffer last time;
size_t getBufferSize()const{return m_BufMemorySize;}
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/Kernel/src/DiskBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace Kernel
*
* @param item :: ISaveable object that is getting deleted.
*/
void DiskBuffer::objectDeleted(ISaveable *const item)
void DiskBuffer::objectDeleted(ISaveable * item)
{
// have it ever been in the buffer?
auto opt2it = item->getBufPostion();
Expand Down Expand Up @@ -133,7 +133,7 @@ namespace Kernel

m_mutex.lock();
// Holder for any objects that you were NOT able to write.
std::list<ISaveable *const> couldNotWrite;
std::list<ISaveable *> couldNotWrite;
size_t objectsNotWritten(0);
size_t memoryNotWritten(0);

Expand Down
10 changes: 6 additions & 4 deletions Code/Mantid/Framework/Kernel/src/ISaveable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ namespace Kernel
//----------------------------------------------------------------------------------------------
/** Copy constructor --> needed for std containers and not to copy mutexes */
ISaveable::ISaveable(const ISaveable & other):
m_fileIndexStart(other.m_fileIndexStart),m_fileNumEvents(other.m_fileNumEvents)
m_fileIndexStart(other.m_fileIndexStart),m_fileNumEvents(other.m_fileNumEvents),
m_BufPosition(other.m_BufPosition),
m_BufMemorySize(other.m_BufMemorySize)
{ }

//ISaveable::ISaveable(const size_t fileId):
Expand All @@ -30,10 +32,10 @@ namespace Kernel
* @param bufPosition -- the allocator which specifies the position of the object in the list of objects to write
* @returns the size of the object it currently occupies in memory. This size is also stored by the object itself for further references
*/
size_t ISaveable::setBufferPosition(std::list<ISaveable *const>::iterator &bufPosition)
size_t ISaveable::setBufferPosition(std::list<ISaveable *>::iterator bufPosition)
{
m_setter.lock();
m_BufPosition = boost::optional<std::list<ISaveable *const>::iterator >(bufPosition);
m_BufPosition = boost::optional<std::list<ISaveable *>::iterator >(bufPosition);
m_BufMemorySize = this->getDataMemorySize();
m_setter.unlock();
return m_BufMemorySize ;
Expand All @@ -59,7 +61,7 @@ namespace Kernel
{
m_setter.lock();
m_BufMemorySize=0;
m_BufPosition = boost::optional<std::list<ISaveable *const>::iterator>();
m_BufPosition = boost::optional<std::list<ISaveable *>::iterator>();
m_setter.unlock();
}
} // namespace Mantid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ namespace MDEvents
::NeXus::File * getFile(){return m_File;}
private:
/// Default size of the events block which can be written in the NeXus array at once identified by efficiency or some other external reasons
static enum {DATA_CHUNK=10000};
enum {DATA_CHUNK=10000};

/// full file name (with path) of the Nexis file responsible for the IO operations (as NeXus filename has very strange properties and often truncated to 64 bytes)
std::string m_fileName;
Expand All @@ -106,7 +106,7 @@ namespace MDEvents
unsigned int m_CoordSize;
/// possible event types this class understands. The enum numbers have to correspond to the numbers of symbolic event types,
/// defined in EVENT_TYPES_SUPPORTED vector
static enum EventType
enum EventType
{
LeanEvent=0, //< the event consisting of signal error and event coordinate
FatEvent=1 //< the event havint the same as lean event plus RunID and detID
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ namespace MDEvents
// add range of events
virtual size_t addEvents(const std::vector<MDE> & events);
// unhide MDBoxBase methods
virtual size_t addEventsUnsafe(const std::vector<MDE> & events)
{return MDBoxBase::addEventsUnsafe( events);}
virtual size_t addEventsUnsafe(const std::vector<MDE> & events);


/*---------------> EVENTS from event data <-------------------------------------------------------------*/
virtual void addEvent(const signal_t Signal,const signal_t errorSq,const std::vector<coord_t> &point, uint16_t runIndex,uint32_t detectorId);
Expand Down
6 changes: 2 additions & 4 deletions Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDGridBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,8 @@ namespace MDEvents
void addEventUnsafe(const MDE & event);
void addAndTraceEvent(const MDE & point,size_t index);
// unhide MDBoxBase methods
virtual size_t addEvents(const std::vector<MDE> & events)
{ return MDBoxBase::addEvents(events); }
virtual size_t addEventsUnsafe(const std::vector<MDE> & events)
{return MDBoxBase::addEventsUnsafe( events);}
virtual size_t addEvents(const std::vector<MDE> & events);
virtual size_t addEventsUnsafe(const std::vector<MDE> & events);


/*---------------> EVENTS from event data <-------------------------------------------------------------*/
Expand Down
12 changes: 9 additions & 3 deletions Code/Mantid/Framework/MDEvents/src/BoxControllerNxSIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "MantidMDEvents/MDBoxFlatTree.h"
#include "MantidKernel/Exception.h"
#include "MantidAPI/FileFinder.h"
#include <NeXusFile.hpp>
#include <nexus/NeXusFile.hpp>

#include <string>

Expand Down Expand Up @@ -35,8 +35,14 @@ namespace MDEvents
{
m_BlockSize[1] = 4+m_bc->getNDims();

m_EventsTypesSupported.assign(EventTypes,std::end(EventTypes));
m_EventsTypeHeaders.assign(EventHeaders,std::end(EventHeaders));
for(size_t i=0;i<2;i++)
{
m_EventsTypesSupported.push_back(EventTypes[i]);
m_EventsTypeHeaders.push_back(EventHeaders[i]);
}

//m_EventsTypesSupported.assign(EventTypes,std::end(EventTypes));
//m_EventsTypeHeaders.assign(EventHeaders,std::end(EventHeaders));
}
/**get event type form its string representation*/
BoxControllerNxSIO::EventType BoxControllerNxSIO::TypeFromString(const std::vector<std::string> &typesSupported,const std::string typeName)
Expand Down
6 changes: 6 additions & 0 deletions Code/Mantid/Framework/MDEvents/src/MDBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ namespace MDEvents

}
}
// unhide MDBoxBase method
TMDE(
size_t MDBox)::addEventsUnsafe(const std::vector<MDE> & events)
{
return MDBoxBase<MDE,nd>::addEventsUnsafe( events);
}


//-----------------------------------------------------------------------------------------------
Expand Down
12 changes: 10 additions & 2 deletions Code/Mantid/Framework/MDEvents/src/MDGridBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,16 @@ namespace MDEvents
// : MDBoxBase<MDE, nd>(), numBoxes(0), nPoints(0)
//{
//}


template<typename MDE,size_t nd>
size_t MDGridBox<MDE,nd>::addEvents(const std::vector<MDE> & events)
{
return MDBoxBase<MDE,nd>::addEvents(events);
}
template<typename MDE,size_t nd>
size_t MDGridBox<MDE,nd>::addEventsUnsafe(const std::vector<MDE> & events)
{
return MDBoxBase<MDE,nd>::addEventsUnsafe( events);
}

//-----------------------------------------------------------------------------------------------
/** Constructor with a box controller.
Expand Down

0 comments on commit 7727efd

Please sign in to comment.