Skip to content

Commit

Permalink
Remove obselete InfoNode class & all references.
Browse files Browse the repository at this point in the history
Refs #7708
  • Loading branch information
martyngigg committed Aug 12, 2013
1 parent 95837e7 commit f8d8c27
Show file tree
Hide file tree
Showing 31 changed files with 2 additions and 526 deletions.
4 changes: 0 additions & 4 deletions Code/Mantid/Framework/API/inc/MantidAPI/AnalysisDataService.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,11 @@ class DLLExport AnalysisDataServiceImpl : public Kernel::DataService<API::Worksp

/** @name Methods to work with workspace groups */
//@{

void addToGroup(const std::string& groupName, const std::string& wsName);
void deepRemoveGroup(const std::string& name);
void removeFromGroup(const std::string& groupName, const std::string& wsName);

//@}

/// Create an info tree out of InfoNodes to describe the current state of the ADS.
Workspace::InfoNode *createInfoTree() const;
/// Return a lookup of the top level items
std::map<std::string,Workspace_sptr> topLevelItems() const;

Expand Down
2 changes: 0 additions & 2 deletions Code/Mantid/Framework/API/inc/MantidAPI/IEventWorkspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ namespace API

protected:
virtual const std::string toString() const;
/// Create and return a new InfoNode describing this workspace.
virtual InfoNode *createInfoNode() const;
};

///shared pointer to the matrix workspace base class
Expand Down
2 changes: 0 additions & 2 deletions Code/Mantid/Framework/API/inc/MantidAPI/IMDEventWorkspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ namespace API

protected:
virtual const std::string toString() const;
/// Create and return a new InfoNode describing this workspace.
virtual InfoNode *createInfoNode() const;
/// Marker set to true when a file-backed workspace needs its back-end file updated (by calling SaveMD(UpdateFileBackEnd=1) )
bool m_fileNeedsUpdating;

Expand Down
2 changes: 0 additions & 2 deletions Code/Mantid/Framework/API/inc/MantidAPI/IMDWorkspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ namespace Mantid

protected:
virtual const std::string toString() const;
/// Create and return a new InfoNode describing this workspace.
virtual InfoNode *createInfoNode() const;
};

/// Shared pointer to the IMDWorkspace base class
Expand Down
2 changes: 0 additions & 2 deletions Code/Mantid/Framework/API/inc/MantidAPI/ITableWorkspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,6 @@ class MANTID_API_DLL ITableWorkspace: public API::Workspace

protected:

virtual InfoNode *createInfoNode() const;

/** Resize a column.
@param c :: Pointer to the column
@param size :: New column size
Expand Down
3 changes: 0 additions & 3 deletions Code/Mantid/Framework/API/inc/MantidAPI/MatrixWorkspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,6 @@ namespace Mantid
/// Initialises the workspace. Sets the size and lengths of the arrays. Must be overloaded.
virtual void init(const std::size_t &NVectors, const std::size_t &XLength, const std::size_t &YLength) = 0;

/// Create and return a new InfoNode describing this workspace.
virtual InfoNode *createInfoNode() const;

/// A vector of pointers to the axes for this workspace
std::vector<Axis*> m_axes;

Expand Down
50 changes: 0 additions & 50 deletions Code/Mantid/Framework/API/inc/MantidAPI/Workspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,50 +56,6 @@ class MANTID_API_DLL Workspace : public Kernel::DataItem
{
public:

/**
* Holds information about a workspace in a vector of strings.
* InfoNodes can contian other nodes and form a tree.
* The purpose is to be returned by the ADS for displaying in the GUI.
*/
class MANTID_API_DLL InfoNode
{
public:
enum IconType {Default = 0, Matrix, Group, MD, Table};
/// Constructor
InfoNode(const Workspace& workspace);
/// Constructor
InfoNode(const AnalysisDataServiceImpl*);
/// Destructor
~InfoNode();
/// Add a new line
void addLine(const std::string& line);
/// Add a new InfoNode object.
void addNode(InfoNode* node);
/// Add experiment info if workspace inherits from ExperimentInfo.
void addExperimentInfo(const Workspace& workspace);
/// Get workspace name
std::string workspaceName() const {return m_workspaceName;}
/// Get memory size
size_t getMemorySize() const {return m_memorySize;}
/// Get the info lines.
const std::vector<std::string>& lines() const {return m_info;}
/// Get the child nodes.
const std::vector<InfoNode*>& nodes() const {return m_nodes;}
/// Get icon type
IconType getIconType() const {return m_icon;}
private:
/// Information about a single workspace. Each string shouldn't be too long.
std::vector<std::string> m_info;
/// Child nodes (eg a WorkspaceGroup will have a child node for each item).
std::vector<InfoNode*> m_nodes;
/// Icon type to use for this workspace
IconType m_icon;
/// Workspace name
std::string m_workspaceName;
/// Memory size taken by the workspace
size_t m_memorySize;
};

Workspace();
Workspace(const Workspace & other);
virtual ~Workspace();
Expand Down Expand Up @@ -128,12 +84,6 @@ class MANTID_API_DLL Workspace : public Kernel::DataItem
WorkspaceHistory& history() { return m_history; }
/// Returns a reference to the WorkspaceHistory const
const WorkspaceHistory& getHistory() const { return m_history; }
/// Add info about this workspace to a parent InfoNode.
void addInfoNodeTo(InfoNode& parentNode) const;

protected:
/// Create and return a new InfoNode describing this workspace.
virtual InfoNode* createInfoNode() const;

private:
void setName(const std::string&);
Expand Down
4 changes: 0 additions & 4 deletions Code/Mantid/Framework/API/inc/MantidAPI/WorkspaceGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ class MANTID_API_DLL WorkspaceGroup : public Workspace

//@}

protected:
/// Create and return a new InfoNode describing this workspace.
virtual InfoNode *createInfoNode() const;

private:
/// Private, unimplemented copy constructor
WorkspaceGroup(const WorkspaceGroup& ref);
Expand Down
30 changes: 0 additions & 30 deletions Code/Mantid/Framework/API/src/AnalysisDataService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,36 +234,6 @@ namespace Mantid
notificationCenter.postNotification(new GroupUpdatedNotification( groupName ));
}

/**
* @return A pointer to the root node of the info tree.
*/
Workspace::InfoNode *AnalysisDataServiceImpl::createInfoTree() const
{
auto workspaces = getObjects();

// collect all groups and put them into temporary rootGroup
WorkspaceGroup rootGroup;
for( auto ws = workspaces.begin(); ws != workspaces.end(); ++ws )
{
WorkspaceGroup_sptr group = boost::dynamic_pointer_cast<WorkspaceGroup>( *ws );
if ( group )
{
rootGroup.addWorkspace( group );
}
}

// build the tree
Workspace::InfoNode *root = new Workspace::InfoNode(this);
for( auto ws = workspaces.begin(); ws != workspaces.end(); ++ws )
{
if ( !rootGroup.isInChildGroup(**ws) )
{
(**ws).addInfoNodeTo( *root );
}
}
return root;
}

/**
* Produces a map of names to Workspaces that doesn't include
* items that are part of a WorkspaceGroup already in the list
Expand Down
23 changes: 0 additions & 23 deletions Code/Mantid/Framework/API/src/IEventWorkspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,29 +39,6 @@ const std::string IEventWorkspace::toString() const
return os.str();
}

/**
* @return :: A pointer to the created info node.
*/
API::Workspace::InfoNode *IEventWorkspace::createInfoNode() const
{
auto node = MatrixWorkspace::createInfoNode();
std::string extra("");
switch ( getEventType() )
{
case WEIGHTED:
extra = " (weighted)";
break;
case WEIGHTED_NOTIME:
extra = " (weighted, no times)";
break;
case TOF:
extra = "";
break;
}
node->addLine( "Events: " + boost::lexical_cast<std::string>(getNumberEvents()) + extra );
return node;
}

}

/*
Expand Down
18 changes: 0 additions & 18 deletions Code/Mantid/Framework/API/src/IMDEventWorkspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,6 @@ namespace API
}

//-----------------------------------------------------------------------------------------------
/**
* @return :: A pointer to the created info node.
*/
Workspace::InfoNode *IMDEventWorkspace::createInfoNode() const
{
auto node = IMDWorkspace::createInfoNode();
// Now box controller details
std::vector<std::string> stats = getBoxControllerStats();
for (size_t i=0; i < stats.size(); i++)
{
node->addLine( stats[i] );
}

node->addLine("Events: " + boost::lexical_cast<std::string>(getNPoints()) );
return node;
}



}//namespace MDEvents

Expand Down
26 changes: 0 additions & 26 deletions Code/Mantid/Framework/API/src/IMDWorkspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,32 +87,6 @@ namespace Mantid
return os.str();
}

//-----------------------------------------------------------------------------------------------

/**
* @return :: A pointer to the created info node.
*/
Workspace::InfoNode *IMDWorkspace::createInfoNode() const
{
auto node = new InfoNode(*this);
node->addLine( "Title: " + getTitle() );
for (size_t i=0; i < getNumDims(); i++)
{
std::ostringstream mess;
Geometry::IMDDimension_const_sptr dim = getDimension(i);
mess << "Dim " << i << ": (" << dim->getName() << ") " << dim->getMinimum() << " to " << dim->getMaximum() << " in " << dim->getNBins() << " bins";
// Also show the dimension ID string, if different than name
if (dim->getDimensionId() != dim->getName())
mess << ". Id=" << dim->getDimensionId();
node->addLine( mess.str() );
}
if ( hasOriginalWorkspace() )
{
node->addLine("Binned from '" + getOriginalWorkspace()->getName() + "'");
}
return node;
}

//-----------------------------------------------------------------------------------------------
/** Obtain coordinates for a line plot through a IMDWorkspace.
* Cross the workspace from start to end points, recording the signal along the line.
Expand Down
15 changes: 0 additions & 15 deletions Code/Mantid/Framework/API/src/ITableWorkspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,6 @@ void ITableWorkspace::modified()
new Kernel::DataService<API::Workspace>::AfterReplaceNotification(this->getName(),tws));
}

/**
* Implement Workspace's virtual method to fill the info node with info
* descriding this table workspace.
*
* @return :: A pointer to the created node.
*/
Workspace::InfoNode *ITableWorkspace::createInfoNode() const
{
auto node = new InfoNode(*this);
node->addLine("Columns: " + boost::lexical_cast<std::string>(columnCount()));
node->addLine("Rows: " + boost::lexical_cast<std::string>(rowCount()));
return node;
}



/** Overridable method to custom-sort the workspace
*
Expand Down
34 changes: 0 additions & 34 deletions Code/Mantid/Framework/API/src/MatrixWorkspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1626,40 +1626,6 @@ namespace Mantid
return Mantid::API::None;
}

/**
* @return :: A pointer to the created node.
*/
Workspace::InfoNode *MatrixWorkspace::createInfoNode() const
{
auto node = new InfoNode(*this);
node->addLine( "Title: " + getTitle() );
node->addLine( "Histograms: " + boost::lexical_cast<std::string>(getNumberHistograms()) );
node->addLine( "Bins: " + boost::lexical_cast<std::string>(blocksize()) );
if ( isHistogramData() )
{
node->addLine( "Histogram" );
}
else
{
node->addLine( "Data points" );
}
std::string s = "X axis: ";
if (axes() > 0 )
{
Axis *ax = getAxis(0);
if ( ax && ax->unit() ) s += ax->unit()->caption() + " / " + ax->unit()->label();
else s += "Not set";
}
else
{
s += "N/A";
}
node->addLine( s );
node->addLine( "Y axis: " + YUnitLabel() );
node->addExperimentInfo(*this);
return node;
}

} // namespace API
} // Namespace Mantid

Expand Down

0 comments on commit f8d8c27

Please sign in to comment.