TechDependency Class Reference

#include <research.h>

Inheritance diagram for TechDependency:

Inheritance graph
[legend]
List of all members.

Public Types

typedef Loki::Functor< bool,
LOKI_TYPELIST_1(int) > 
CheckTechAvailabilityFunctor

Public Member Functions

 TechDependency ()
bool available (const Research &research) const
ResearchAvailabilityStatus available (CheckTechAvailabilityFunctor checkTechAvailability) const
bool eventually_available (const Research &res, list< const Technology * > *dependencies) const
 this will recursively scan through the tech tree to check if this item will be available sometime.
bool eventually_available (const Research &res, list< const Technology * > *dependencies, list< int > &stack) const
ASCString showDebug (const Research &research) const
void read (tnstream &stream)
 read the binary representation of this item from the given stream
void write (tnstream &stream) const
 write the binary representation of this item to the given stream
void runTextIO (PropertyContainer &pc)
 registers the properties of this item for loading/writing into asctxt files
bool empty () const
void writeTreeOutput (const ASCString &sourceTechName, tnstream &stream, bool reduce) const
 outputs the dependencies in text format for processing by GraphViz
void writeInvertTreeOutput (const Technology *tech, tnstream &stream, vector< int > &history, vector< pair< int, int > > &blockedPrintList, const vector< IntRange > *onlyWithBaseTechs=NULL) const
void writeInvertTreeOutput (const ASCString techName, tnstream &stream, vector< int > &history, vector< pair< int, int > > &blockedPrintList, const vector< IntRange > *onlyWithBaseTechs=NULL) const
int findInheritanceLevel (int id, vector< int > &stack, const ASCString &sourceTechName) const

Detailed Description

Definition at line 48 of file research.h.


Member Typedef Documentation

typedef Loki::Functor<bool, LOKI_TYPELIST_1(int) > TechDependency::CheckTechAvailabilityFunctor

Definition at line 61 of file research.h.


Constructor & Destructor Documentation

TechDependency::TechDependency (  )  [inline]

Definition at line 58 of file research.h.


Member Function Documentation

bool TechDependency::available ( const Research research  )  const

Definition at line 61 of file research.cpp.

References Available, and Research::techResearched().

Referenced by TechAdapter::available(), DirectResearchCommand::go(), and Research::techAvailable().

ResearchAvailabilityStatus TechDependency::available ( CheckTechAvailabilityFunctor  checkTechAvailability  )  const

Definition at line 66 of file research.cpp.

References Available, NeverAvailable, and UnavailableNow.

bool TechDependency::eventually_available ( const Research res,
list< const Technology * > *  dependencies 
) const

this will recursively scan through the tech tree to check if this item will be available sometime.

Parameters:
dependencies if not NULL, the technologies which have to be developed prior to this one will be added here

Definition at line 122 of file research.cpp.

Referenced by Technology::eventually_available().

bool TechDependency::eventually_available ( const Research res,
list< const Technology * > *  dependencies,
list< int > &  stack 
) const

Definition at line 102 of file research.cpp.

ASCString TechDependency::showDebug ( const Research research  )  const

Definition at line 331 of file research.cpp.

References Technology::id, Technology::name, technologyRepository, and Research::techResearched().

Referenced by ChooseTech::showPrerequisites().

void TechDependency::read ( tnstream stream  )  [virtual]

read the binary representation of this item from the given stream

Implements LoadableItemType.

Definition at line 33 of file research.cpp.

References tnstream::getDeviceName(), readClassContainer(), tnstream::readInt(), and techDependencyVersion.

Referenced by Technology::read(), and TechAdapter::read().

void TechDependency::write ( tnstream stream  )  const [virtual]

write the binary representation of this item to the given stream

Implements LoadableItemType.

Definition at line 45 of file research.cpp.

References techDependencyVersion, writeClassContainer(), and tnstream::writeInt().

Referenced by Technology::write(), and TechAdapter::write().

void TechDependency::runTextIO ( PropertyContainer pc  )  [virtual]

registers the properties of this item for loading/writing into asctxt files

Implements LoadableItemType.

Definition at line 53 of file research.cpp.

References PropertyContainer::addBool(), PropertyContainer::addIntRangeArray(), PropertyContainer::find(), and PropertyContainer::isReading().

Referenced by Technology::runTextIO(), and TechAdapter::runTextIO().

bool TechDependency::empty (  )  const [inline]

Definition at line 76 of file research.h.

void TechDependency::writeTreeOutput ( const ASCString sourceTechName,
tnstream stream,
bool  reduce 
) const

outputs the dependencies in text format for processing by GraphViz

Definition at line 173 of file research.cpp.

References findInheritanceLevel(), Technology::name, technologyRepository, and tnstream::writeString().

void TechDependency::writeInvertTreeOutput ( const Technology tech,
tnstream stream,
vector< int > &  history,
vector< pair< int, int > > &  blockedPrintList,
const vector< IntRange > *  onlyWithBaseTechs = NULL 
) const

Definition at line 237 of file research.cpp.

References findInheritanceLevel(), generateTechLabel(), generateTechName(), Technology::id, Technology::techDependency, technologyRepository, writeInvertTreeOutput(), and tnstream::writeString().

Referenced by generateTechTree(), and writeInvertTreeOutput().

void TechDependency::writeInvertTreeOutput ( const ASCString  techName,
tnstream stream,
vector< int > &  history,
vector< pair< int, int > > &  blockedPrintList,
const vector< IntRange > *  onlyWithBaseTechs = NULL 
) const

Definition at line 287 of file research.cpp.

References findInheritanceLevel(), generateTechName(), Technology::id, Technology::techDependency, technologyRepository, writeInvertTreeOutput(), and tnstream::writeString().

int TechDependency::findInheritanceLevel ( int  id,
vector< int > &  stack,
const ASCString sourceTechName 
) const

Definition at line 130 of file research.cpp.

References findInheritanceLevel(), Technology::name, Technology::techDependency, technologyRepository, and warningMessage().

Referenced by findInheritanceLevel(), writeInvertTreeOutput(), and writeTreeOutput().


The documentation for this class was generated from the following files:
Generated on Mon May 21 01:47:45 2012 for Advanced Strategic Command by  doxygen 1.5.1