Loading...
Searching...
No Matches
CProgramStorageObject Class Referenceabstract

Interface for objects that store CBOT programs. More...

`#include <src/object/interface/program_storage_object.h>`

Inheritance diagram for CProgramStorageObject:
[legend]

## Public Member Functions

| CProgramStorageObject (ObjectInterfaceTypes &types)
virtual bool | IntroduceVirus ()=0
virtual void | SetActiveVirus (bool bActive)=0
virtual bool | GetActiveVirus ()=0
| Checks virus active status.
virtual bool | ReadProgram (Program *program, const std::string &filename)=0
| Read program from a given file.
virtual bool | WriteProgram (Program *program, const std::string &filename)=0
| Write program to a given file.
virtual bool | GetCompile (Program *program)=0
| Check if program was compiled successfully.
virtual Program * | AddProgram ()=0
| Add a new program.
virtual void | AddProgram (std::unique_ptr< Program > program)=0
| Add given program to the program list stored in this robot.
virtual void | RemoveProgram (Program *program)=0
| Remove program.
virtual Program * | CloneProgram (Program *program)=0
| Clone a program.
virtual std::vector< std::unique_ptr< Program > > & | GetPrograms ()=0
| Return a std::vector of all available programs.
virtual int | GetProgramCount ()=0
| Return count of all programs.
virtual Program * | GetProgram (int index)=0
| Return program with the given index.
virtual Program * | GetOrAddProgram (int index)=0
| Return program at the given index (creating it and all previous ones as needed).
virtual int | GetProgramIndex (Program *program)=0
| Return index in the list of given Program instance.
virtual void | SetProgramStorageIndex (int programStorageIndex)=0
| Set index for use in filename for saved programs (-1 to disable).
virtual int | GetProgramStorageIndex ()=0
| Return index that is used while saving programs.
virtual void | SaveAllUserPrograms (const std::string &userSource)=0
| Save all user programs.
virtual void | LoadAllProgramsForLevel (CLevelParserLine *levelSource, const std::string &userSource, bool loadSoluce)=0
| Load all programs when loading the level including previously saved user programs.
virtual void | SaveAllProgramsForSavedScene (CLevelParserLine *levelSourceLine, const std::string &levelSource)=0
| Save all programs when saving the saved scene.
virtual void | LoadAllProgramsForSavedScene (CLevelParserLine *levelSourceLine, const std::string &levelSource)=0
| Load all programs when loading the saved scene.

## Detailed Description

Interface for objects that store CBOT programs.

## Member Function Documentation

## IntroduceVirus()

virtual bool CProgramStorageObject::IntroduceVirus | ( |  | ) |

pure virtual

Infects a random program of a robot with virus

Returns
  true if program was successfully infected, false on failure (no programs or no suitable keywords to infect found)

Implemented in CProgramStorageObjectImpl.

## SetActiveVirus()

virtual void CProgramStorageObject::SetActiveVirus | ( | bool | bActive | ) |

pure virtual

Sets the virus as active, this controls the "Program infected" message and is cleared after you edit the program. Note that this status is independent from the virus particles (see COldObject::SetVirusMode for that)

Implemented in CProgramStorageObjectImpl.

## GetActiveVirus()

virtual bool CProgramStorageObject::GetActiveVirus | ( |  | ) |

pure virtual

Checks virus active status.

Implemented in CProgramStorageObjectImpl.

## ReadProgram()

virtual bool CProgramStorageObject::ReadProgram | ( | Program * | program,
|  | const std::string & | filename )

pure virtual

Read program from a given file.

Implemented in CProgramStorageObjectImpl.

## WriteProgram()

virtual bool CProgramStorageObject::WriteProgram | ( | Program * | program,
|  | const std::string & | filename )

pure virtual

Write program to a given file.

Implemented in CProgramStorageObjectImpl.

## GetCompile()

virtual bool CProgramStorageObject::GetCompile | ( | Program * | program | ) |

pure virtual

Check if program was compiled successfully.

Implemented in CProgramStorageObjectImpl.

## AddProgram() [1/2]

virtual Program * CProgramStorageObject::AddProgram | ( |  | ) |

pure virtual

Add a new program.

Implemented in CProgramStorageObjectImpl.

## AddProgram() [2/2]

virtual void CProgramStorageObject::AddProgram | ( | std::unique_ptr< Program > | program | ) |

pure virtual

Add given program to the program list stored in this robot.

Implemented in CProgramStorageObjectImpl.

## RemoveProgram()

virtual void CProgramStorageObject::RemoveProgram | ( | Program * | program | ) |

pure virtual

Remove program.

Implemented in CProgramStorageObjectImpl.

## CloneProgram()

virtual Program * CProgramStorageObject::CloneProgram | ( | Program * | program | ) |

pure virtual

Clone a program.

Implemented in CProgramStorageObjectImpl.

## GetPrograms()

virtual std::vector< std::unique_ptr< Program > > & CProgramStorageObject::GetPrograms | ( |  | ) |

pure virtual

Return a std::vector of all available programs.

Implemented in CProgramStorageObjectImpl.

## GetProgramCount()

virtual int CProgramStorageObject::GetProgramCount | ( |  | ) |

pure virtual

Return count of all programs.

Implemented in CProgramStorageObjectImpl.

## GetProgram()

virtual Program * CProgramStorageObject::GetProgram | ( | int | index | ) |

pure virtual

Return program with the given index.

Implemented in CProgramStorageObjectImpl.

## GetOrAddProgram()

virtual Program * CProgramStorageObject::GetOrAddProgram | ( | int | index | ) |

pure virtual

Return program at the given index (creating it and all previous ones as needed).

Implemented in CProgramStorageObjectImpl.

## GetProgramIndex()

virtual int CProgramStorageObject::GetProgramIndex | ( | Program * | program | ) |

pure virtual

Return index in the list of given Program instance.

Implemented in CProgramStorageObjectImpl.

## SetProgramStorageIndex()

virtual void CProgramStorageObject::SetProgramStorageIndex | ( | int | programStorageIndex | ) |

pure virtual

Set index for use in filename for saved programs (-1 to disable).

Implemented in CProgramStorageObjectImpl.

## GetProgramStorageIndex()

virtual int CProgramStorageObject::GetProgramStorageIndex | ( |  | ) |

pure virtual

Return index that is used while saving programs.

Implemented in CProgramStorageObjectImpl.

## SaveAllUserPrograms()

virtual void CProgramStorageObject::SaveAllUserPrograms | ( | const std::string & | userSource | ) |

pure virtual

Save all user programs.

Implemented in CProgramStorageObjectImpl.

## LoadAllProgramsForLevel()

virtual void CProgramStorageObject::LoadAllProgramsForLevel | ( | CLevelParserLine * | levelSource,
|  | const std::string & | userSource,
|  | bool | loadSoluce )

pure virtual

Load all programs when loading the level including previously saved user programs.

Implemented in CProgramStorageObjectImpl.

## SaveAllProgramsForSavedScene()

virtual void CProgramStorageObject::SaveAllProgramsForSavedScene | ( | CLevelParserLine * | levelSourceLine,
|  | const std::string & | levelSource )

pure virtual

Save all programs when saving the saved scene.

Implemented in CProgramStorageObjectImpl.

## LoadAllProgramsForSavedScene()

virtual void CProgramStorageObject::LoadAllProgramsForSavedScene | ( | CLevelParserLine * | levelSourceLine,
|  | const std::string & | levelSource )

pure virtual

Load all programs when loading the saved scene.

Implemented in CProgramStorageObjectImpl.

The documentation for this class was generated from the following file:

- src/object/interface/program_storage_object.h