Skip to content

Instantly share code, notes, and snippets.

@mitchute
Last active February 11, 2016 21:48
Show Gist options
  • Save mitchute/d554da92ae701009aa10 to your computer and use it in GitHub Desktop.
Save mitchute/d554da92ae701009aa10 to your computer and use it in GitHub Desktop.
// In header
class PipingSystemDomainClass : public BaseDomainClass
{
public:
// Members
// Default Constructor
PipingSystemDomainClass(){}
// Destructor
~PipingSystemDomainClass(){}
// Member Functions
};
extern std::vector< PipingSystemDomainClass > PipingSystemSegments;
PipingSystemDomainClass
GetPipingSystemDomainAndInit(
std::string const & EquipName, // name of the Pipe Heat Transfer
int & EqNum // index in local derived types for external calling
);
// In .cc file
PipingSystemDomainClass
GetPipingSystemDomainAndInit(
std::string const & EquipName, // name of the Pipe Heat Transfer
int & EqNum // index in local derived types for external calling
)
{
// Check if this instance of this model has already been retrieved
for ( int i = 0; i < numPipingSystemDomains; ++i ) {
// Check if the type and name match
if ( EquipName == PipingSystemDomains[i].Name ) {
return &PipingSystemDomains[i];
}
}
// Object not found
// New pointer for this model object
thisModel & new PipingSystemDomainClass();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment