source: NonGTP/FCollada/FCDocument/FCDEffectParameterList.h @ 964

Revision 964, 4.4 KB checked in by igarcia, 18 years ago (diff)
Line 
1/*
2        Copyright (C) 2005-2006 Feeling Software Inc.
3        MIT License: http://www.opensource.org/licenses/mit-license.php
4*/
5
6/**
7        @file FCDEffectParameterList.h
8        This file contains the FCDEffectParameterList class.
9*/
10
11#ifndef _FCD_EFFECT_PARAMETER_LIST_H_
12#define _FCD_EFFECT_PARAMETER_LIST_H_
13
14class FCDEffectParameter;
15
16/**
17        A searchable list of COLLADA effect parameters.
18
19        This class is based on the STL vector class and adds some
20        useful search methods: by reference and by semantic.
21
22        @ingroup FCDEffect
23*/
24class FCOLLADA_EXPORT FCDEffectParameterList : public vector<FCDEffectParameter*>, public FCDObject
25{
26private:
27        DeclareObjectType;
28        bool ownParameters;
29
30public:
31        /** Constructor.
32                All the objects that need a parameter list will create it when necessary.
33                You may also create new lists for the retrieval of parameters during a search.
34                @param document The COLLADA document that owns this parameter list. This pointer
35                        can remain NULL unless you expect to create new parameters within this list.
36                @param ownParameters Whether this list should release the contained parameters
37                        during its destruction. */
38        FCDEffectParameterList(FCDocument* document = NULL, bool ownParameters = false);
39
40        /** Destructor. */
41        virtual ~FCDEffectParameterList();
42
43        /** Creates a new parameters within this list.
44                @param type The effect parameter type.
45                @return The new effect parameter. This pointer will be NULL if this list does not own its parameters. */
46        FCDEffectParameter* AddParameter(uint32 type);
47
48        /** Releases a parameter contained within this list.
49                The memory used by this parameter will be released only if this list owns the parameters.
50                @param parameter The effect parameter to release. */
51        void ReleaseParameter(FCDEffectParameter* parameter);
52
53        /** Retrieves the first effect parameter with the given reference.
54                For effect parameter generators, the sub-id is used instead of the reference.
55                @param reference A reference to match.
56                @return The effect parameter that matches the reference. This pointer will be NULL,
57                        if no parameter matches the reference. */
58        FCDEffectParameter* FindReference(const char* reference);
59        const FCDEffectParameter* FindReference(const char* reference) const; /**< See above. */
60        inline FCDEffectParameter* FindReference(const string& reference) { return FindReference(reference.c_str()); } /**< See above. */
61        inline const FCDEffectParameter* FindReference(const string& reference) const { return FindReference(reference.c_str()); } /**< See above. */
62
63        /** Retrieves the first effect parameter with the given semantic.
64                @param semantic A semantic to match.
65                @return The effect parameter that matches the semantic. This pointer will be NULL
66                        if no parameter matches the semantic. */
67        FCDEffectParameter* FindSemantic(const char* semantic);
68        const FCDEffectParameter* FindSemantic(const char* semantic) const; /**< See above. */
69        inline FCDEffectParameter* FindSemantic(const string& semantic) { return FindReference(semantic.c_str()); } /**< See above. */
70        inline const FCDEffectParameter* FindSemantic(const string& semantic) const { return FindReference(semantic.c_str()); } /**< See above. */
71
72        /** Retrieves a subset of this parameter list.
73                All the effects that match the given reference will be added to the given list.
74                For effect parameter generators, the sub-id is used instead of the reference.
75                @param reference A reference to match.
76                @param list The effect parameter list to fill in with the matched parameters.
77                        This list is not clear. */
78        void FindReference(const char* reference, FCDEffectParameterList& list);
79        inline void FindReference(const string& reference, FCDEffectParameterList& list) { return FindReference(reference.c_str(), list); } /**< See above. */
80
81        /** Retrieves a subset of this parameter list.
82                All the effects that match the given semantic will be added to the given list.
83                @param semantic A semantic to match.
84                @param list The effect parameter list to fill in with the matched parameters.
85                        This list is not clear. */
86        void FindSemantic(const char* semantic, FCDEffectParameterList& list);
87        inline void FindSemantic(const string& semantic, FCDEffectParameterList& list) { return FindReference(semantic.c_str(), list); } /**< See above. */
88
89        /** Creates a full copy of the list of parameters and its content.
90                @return The cloned list. You will need to delete this pointer.*/
91        FCDEffectParameterList* Clone() const;
92};
93
94#endif // _FCD_EFFECT_PARAMETER_LIST_H_
Note: See TracBrowser for help on using the repository browser.