49/// @brief The declaration of the @ref Mezzanine::Threading::AsynchronousFileLoadWorkUnit "AsynchronousFileLoadWorkUnit" a workunit that loads a listing of files asynchronously.
50namespace Mezzanine
51 {
52namespace Threading
53 {
54#ifndef SWIG
55 /// @brief An Internal helper function for the @ref AsynchronousFileLoadWorkUnit. This is the function that AsynchronousFileLoadWorkUnit instances will use to load data.
56 /// @details There is a 1 to 1 relationship between this function and its associated @ref Mezzanine::Threading::AsynchronousFileLoadWorkUnit "AsynchronousFileLoadWorkUnit".
57 /// This is the function run in another thread to allow loading asynchrously.
58 /// @param WU A pointer to the @ref Mezzanine::Threading::AsynchronousFileLoadWorkUnit "AsynchronousFileLoadWorkUnit" that is passed to the asynchronous thread to be used as metadata.
117 /// @brief The contents of the files once they have been loaded. No partial files will exists here, either the whole file is added or nothing is added.
133 /// @brief Begin loading a list of files based on their names.
134 /// @param Filenames_ A vector of Strings that correspond to either relative or absolute filenames that will be loaded.
135 /// @details When the file is loaded its contents are placed in a @ref RawFile and can be retrieved with @ref GetFile
136 /// or @ref GetFile member functions.
137 /// @n @n
138 /// This starts by clearing the previous list of loaded files. If that list has not been deleted then
139 /// this will cause a memory leak. Use @ref DeleteLoadedFiles to clear this list or copy all the pointers elsewhere before
140 /// calling this and delete them manually at your convience. When this work unit is destroyed it deletes any loaded files from
141 /// the last call of this method.
142 /// @n @n
143 /// If this is called while it is loading files the behavior is undefined, most likely it will crash or fail silently, either
144 /// way no good can come from it. Use @ref IsWorkDone to see if the work is @ref Complete "Complete". If the work is complete
145 /// then this can be called after any call to this class's @ref DoWork member function.
146 /// @warning This can leak memory if not used in conjuction with memory management or @ref DeleteLoadedFiles and read the details.
147 /// @warning This can fail in horrible ways if called twice without waiting for the first call to finish, use @ref IsWorkDone and read the details.
148 /// @return This returns @ref Starting "Starting" when loading is successful started and who knows what it returns if it fails, likely a segfault or GPF.
154 /// @brief Get the @ref RunningState of the file loading
155 /// @details This can return any @ref RunningState and the meaning applies to the current state of the files being loaded.
156 /// - @ref NotStarted "NotStarted" - Either @ref BeginLoading has not been called or it has been called and has not progressed to the point where it sets this. Not useful for making logical decisions without knowledge of how many times @ref BeginLoading has been called.
157 /// - @ref Starting "Starting" - This is returned from @ref BeginLoading is success conditions, and is never returned from this.
158 /// - @ref Running "Running" - This means that the loading thread has started but not yet completed.
159 /// - @ref Complete "Complete" - The loading thread has completed its work, and new loading can definitely begin after the next call to @ref DoWork method.
160 /// - @ref Failed "Failed" - If somekind of recoverable error occured, this will be returned, there are no guarantees about the state of the loaded files.
161 /// @return The running state as of the time of this call, though it is subject to immediate thread unsafe change.
170 /// @brief Retrieve a pointer to file contents in constant time.
171 /// @param Index The index of the File Name when it was passed into @ref BeginLoading "BeginLoading".
172 /// @return This returns a null pointer if the correct @ref RawFile cannot be retrieved, otherwise a pointer to the @ref RawFile with index corresponing to the index of a passed in filename is returned.
173 /// @warning Do no call this before @ref IsWorkDone() indicates that the work is @ref Complete "Complete". These memory addresses are subject to change until all loading is complete.