1 #ifndef HECLDATABASE_HPP
2 #define HECLDATABASE_HPP
9 #include <unordered_map>
15 #include <Athena/IStreamReader.hpp>
44 std::vector<Node> m_nodes;
46 const Node* getRootNode()
const {
return &m_nodes[0];}
63 virtual bool canExtract(
const ExtractPassInfo& info) {(void)info;
return false;}
64 virtual void doExtract(
const ExtractPassInfo& info) {(void)info;}
71 virtual bool canPackage(
const PackagePassInfo& info) {(void)info;
return false;}
72 virtual void doPackage(
const PackagePassInfo& info) {(void)info;}
82 std::function<IDataSpec*(void)> factory;
122 typedef std::function<void(const void* data, size_t len)> FDataAppender;
137 {(void)dataAppender;(void)endianness;(void)platform;
return true;}
139 typedef std::function<void(ObjectBase*)> FDepAdder;
156 inline const SystemString& getPath()
const {
return m_path;}
171 typedef std::vector<std::pair<const DataSpecEntry&, bool>> CompiledSpecs;
174 CompiledSpecs m_compiledSpecs;
186 SystemString m_filepath;
187 std::vector<std::string> m_lines;
188 FILE* m_lockedFile = NULL;
191 const std::vector<std::string>& lockAndRead();
192 void addLine(
const std::string& line);
193 void removeLine(
const std::string& refLine);
194 bool checkForLine(
const std::string& refLine);
195 void unlockAndDiscard();
196 void unlockAndCommit();
210 SystemString m_filepath;
212 size_t m_maxPathLen = 0;
213 size_t m_onlyUpdatedMaxPathLen = 0;
214 FILE* m_lockedFile = NULL;
221 bool m_updated =
false;
223 : m_path(path), m_lastModtime(lastModtime) {}
227 size_t m_updatedCount = 0;
228 std::vector<Entry> m_entryStore;
229 std::unordered_map<ProjectPath, Entry*> m_entryLookup;
232 const std::vector<Entry>& lockAndRead();
233 const std::vector<ProjectPath*> getChangedPaths();
235 void unlockAndDiscard();
236 void unlockAndCommit(
bool onlyUpdated=
false);
287 bool addPaths(
const std::vector<ProjectPath>& paths);
298 bool removePaths(
const std::vector<ProjectPath>& paths,
bool recursive=
false);
355 std::function<
void(SystemString&,
Cost,
unsigned)> feedbackCb,
356 bool recursive=
false);
393 #endif // HECLDATABASE_HPP
bool removeGroup(const ProjectPath &path)
Unregister a working sub-directory as a dependency group.
void registerLogger(HECL::FLogger logger)
Register an optional callback to report log-messages using.
Subclassed by dataspec entries to manage per-game aspects of the data pipeline.
Definition: HECLDatabase.hpp:55
bool cleanPath(const ProjectPath &path, bool recursive=false)
Delete cooked objects for directory.
bool addGroup(const ProjectPath &path)
Register a working sub-directory as a Dependency Group.
const CompiledSpecs & getDataSpecs()
Return map populated with dataspecs targetable by this project interface.
Definition: HECLDatabase.hpp:327
bool enableDataSpecs(const std::vector< SystemString > &specs)
Enable persistent user preference for particular spec string(s)
Definition: HECLDatabase.hpp:216
Definition: HECLDatabase.hpp:108
virtual void _gatherDeps(FDepAdder depAdder)
Optional private method implemented by CProjectObject subclasses to resolve dependencies.
Definition: HECLDatabase.hpp:149
Definition: HECLDatabase.hpp:30
Definition: HECLDatabase.hpp:119
Base object to subclass for integrating with key project operations.
Definition: HECLDatabase.hpp:95
IDataSpec registry entry.
Definition: HECLDatabase.hpp:78
Nodegraph class for gathering dependency-resolved objects for packaging.
Definition: HECLDatabase.hpp:27
void interruptCook()
Interrupts a cook in progress (call from SIGINT handler)
Definition: HECLDatabase.hpp:118
Cost
A rough description of how 'expensive' a given cook operation is.
Definition: HECLDatabase.hpp:255
Main project interface.
Definition: HECLDatabase.hpp:168
PackageDepsgraph buildPackageDepsgraph(const ProjectPath &path)
Constructs a full depsgraph of the project-subpath provided.
Timestamp representation used for comparing modtimes of cooked resources.
Definition: HECL.hpp:280
DataEndianness
Byte-order of target system.
Definition: HECLDatabase.hpp:104
Special ProjectRootPath subclass for opening HECLDatabase::IProject instances.
Definition: HECL.hpp:425
Internal packagePath() exception.
Definition: HECLDatabase.hpp:248
Definition: HECLDatabase.hpp:107
const ProjectRootPath & getProjectRootPath() const
Get the path of the project's root-directory.
Definition: HECLDatabase.hpp:278
Definition: HECLDatabase.hpp:117
Configuration file handle.
Definition: HECLDatabase.hpp:184
Definition: HECLDatabase.hpp:66
bool removePaths(const std::vector< ProjectPath > &paths, bool recursive=false)
Remove a given file or file-pattern from the database.
bool disableDataSpecs(const std::vector< SystemString > &specs)
Disable persistent user preference for particular spec string(s)
Canonicalized project path representation using POSIX conventions.
Definition: HECL.hpp:310
bool cookPath(const ProjectPath &path, std::function< void(SystemString &, Cost, unsigned)> feedbackCb, bool recursive=false)
Begin cook process for specified directory.
DataPlatform
Data-formats of target system.
Definition: HECLDatabase.hpp:114
virtual bool _cookObject(FDataAppender dataAppender, DataEndianness endianness, DataPlatform platform)
Optional private method implemented by CProjectObject subclasses to cook objects. ...
Definition: HECLDatabase.hpp:135
Index file handle.
Definition: HECLDatabase.hpp:208
bool addPaths(const std::vector< ProjectPath > &paths)
Add given file(s) to the database.