9 #ifndef PDG_CUSTOM_HANDLERS_H
10 #define PDG_CUSTOM_HANDLERS_H
164 bool requires_outputs,
167 , mySchedulerFilter(schedulers)
168 , myNodeFilter(nodes)
169 , myRequiresOutputs(requires_outputs)
170 , myIsGlobal(global) {}
174 virtual
bool handleDirty(
176 const
PDG_File::Set& files) const = 0;
179 bool matchNode(const
PDG_Node* node);
184 {
return myRequiresOutputs; }
186 {
return myIsGlobal; }
192 bool myRequiresOutputs;
216 : myUseModTime(use_mod_time) {}
226 exint last_update) const = 0;
227 inline
bool useModTime()
const
228 {
return myUseModTime; }
239 : myIsGenerateGraph(is_generate_graph) {}
243 virtual
bool preflight(
247 inline
bool isGenerateGraph()
const
248 {
return myIsGenerateGraph; }
251 bool myIsGenerateGraph;
298 {
return myCacheHandlers; }
302 {
return myStatHandlers; }
306 {
return myTransferHandlers; }
310 {
return myDirtyHandlers; }
314 {
return myRegenHandlers; }
318 {
return myPreflightHandlers; }
323 bool addCacheHandler(
325 CacheHandler* handler);
331 StatHandler* handler);
334 void addDirtyHandler(DirtyHandler* handler);
337 void addRegenerationHandler(
338 RegenerationHandler* handler);
341 bool addTransferHandler(
343 TransferHandler* handler);
346 void addPreflightHandler(
347 PreflightHandler* handler);
350 bool hasDirtyHandlers(
351 DirtyHandlerType
type)
const;
354 void clearHandlers();
357 CacheResult handleCache(
370 void handleDirtyGlobal(
372 bool remove_outputs)
const;
380 bool remove_outputs)
const;
384 RegenerateResult handleRegenerate(
390 TransferPair handleTransfer(
397 exint last_update)
const;
401 bool handlePreflight(
412 bool matchDirtyHandler(
417 bool remove_outputs)
const;
440 bool myIsHandlingPreflight;
The custom handler failed to transfer the file.
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
virtual ~RegenerationHandler()
UT_UniquePtr< StatHandler > StatHandlerPtr
Unique pointer to a custom stat handler.
UT_UniquePtr< CacheHandler > CacheHandlerPtr
Unique pointer to a custom cache handler.
const PreflightHandlerArray & preflightHandlers() const
Custom functor for handling dirtied work items, and possibly output.
UT_UniquePtr< RegenerationHandler > RegenHandlerPtr
Unique pointer to a custom regeneration handler.
PreflightHandler(bool is_generate_graph)
The custom handler has determined that the file was found.
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
const TransferHandlerMap & transferHandlers() const
Returns the map of transfer handlers, tag -> handler.
The custom handler has determined that the file was not cached.
const DirtyHandlerArray & dirtyHandlers() const
Returns the array of dirty handlers.
PDG_File::Hash myHash
The hash/mod time of the file.
const CacheHandlerMap & cacheHandlers() const
Returns the map of cache handlers, tag -> handler.
UT_UniquePtr< DirtyHandler > DirtyHandlerPtr
Unique pointer to a custom delete handler.
virtual ~PreflightHandler()
int64 Hash
The file hash/modtime type.
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
DirtyHandler(DirtyHandlerType type, const UT_ArrayStringSet &schedulers, const UT_ArrayStringSet &nodes, bool requires_outputs, bool global)
TransferResult myResult
The transfer result, e.g. failed or cached.
DirtyHandlerType
Enumeration of different levels of dirty handler.
const RegenHandlerArray & regenerationHandlers() const
TransferHandler(bool use_mod_time)
Custom handler functor for running pre-flight logic before a cook.
Custom functor for stating a file and returning a size/hash.
exint mySize
The size of the file.
The custom dirty handler runs for any dirtied work items.
Regenerate attributes but leave cache files as-is.
Do not regenerate work item attributes nor invalidate cache files.
bool requiresOutputs() const
exint myCacheID
the user-defined cache id
The custom handler successfully transfered the file.
UT_UniquePtr< PreflightHandler > PreflightHandlerPtr
Unique pointer to a custom preflight handler.
virtual ~TransferHandler()
const StatHandlerMap & statHandlers() const
Returns the map of stat handlers, tag -> handler.
TransferResult
Enumeration of different file transfer handle results.
UT_UniquePtr< TransferHandler > TransferHandlerPtr
Unique pointer to a custom transfer handler.
CacheResult
Return result for custom cache handlers.