HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_Functor.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_Functor.h
7  *
8  * COMMENTS:
9  * This functor implementation is adapted from "Modern C++ Design"
10  * by Andrei Alexandrescu. You needn't be concerned with how it
11  * works if you just want to use it.
12  *
13  * Note that these functors use value semantics. So, you can safely
14  * assign from one functor to another and it is safe to pass
15  * functors (without a reference or pointer) to a function.
16  *
17  * Using functors with functions:
18  * int function();
19  * UT_Functor<int> functor1(function);
20  * result = functor1();
21  *
22  * Using functors with methods:
23  * class TestClass has method getValue() that returns an int.
24  * TestClass object;
25  * UT_Functor<int> functor2(&object, &TestClass::getValue);
26  * result = functor2();
27  *
28  * Using functors with other functors:
29  * UT_Functor<int> functor3;
30  * functor3 = functor1;
31  * result = functor3();
32  *
33  * Using functors with arguments:
34  * int function2(int);
35  * UT_Functor1<int, int> functor4(function);
36  * result = functor4(5);
37  *
38  * Using functors as callbacks;
39  * UT_Functor<int, int> myCallback;
40  * void setCallback(UT_Functor<int, int> functor)
41  * { myCallback = functor; }
42  * void executeCallback()
43  * {
44  * if (myCallback.isset())
45  * result = myCallback(myValue);
46  * }
47  *
48  * Encapsulating data in functors by binding values to arguments:
49  * UT_Functor<int, int> functor5(function2);
50  * UT_Functor<int> functor6;
51  * functor6 = UT_BindFirst(functor5, 7);
52  * result = functor6();
53  */
54 
55 #ifndef __UT_Functor_h__
56 #define __UT_Functor_h__
57 
58 #include "UT_Assert.h"
59 #include <SYS/SYS_Types.h>
60 
61 // These are pure virtual interfaces for the classes that do the real work
62 // for the UT_Functor wrapper class. There are different classes for
63 // functors that take different number of parameters.
64 template <typename R>
66 {
67 public:
68  typedef R ReturnType;
69  virtual ReturnType operator()() const = 0;
70 
71  // Return a copy of this functor implementation.
72  virtual UT_FunctorImpl<ReturnType> *clone() const = 0;
73 
74  // We need to make the destructor virtual in this base class, even
75  // though it doesn't need to do anything here.
76  virtual ~UT_FunctorImpl() {}
77 
78 protected:
79  UT_FunctorImpl() = default;
80  UT_FunctorImpl(const UT_FunctorImpl &) = default;
81  UT_FunctorImpl &operator=(const UT_FunctorImpl &) = delete;
82 };
83 
84 // ---------------------------------------------------------------------------
85 
86 template <typename R, typename P1>
88 {
89 public:
90  typedef R ReturnType;
91  typedef P1 Parm1Type;
92  virtual ReturnType operator()(Parm1Type parm1) const = 0;
93  virtual UT_FunctorImpl1<ReturnType, Parm1Type> *clone() const = 0;
94  virtual int64 getMemoryUsage(bool inclusive) const = 0;
95  virtual ~UT_FunctorImpl1() {}
96 protected:
97  UT_FunctorImpl1() = default;
98  UT_FunctorImpl1(const UT_FunctorImpl1 &) = default;
99  UT_FunctorImpl1 &operator=(const UT_FunctorImpl1 &) = delete;
100 };
101 
102 // ---------------------------------------------------------------------------
103 
104 template <typename R, typename P1, typename P2>
106 {
107 public:
108  typedef R ReturnType;
109  typedef P1 Parm1Type;
110  typedef P2 Parm2Type;
111  virtual ReturnType operator()(Parm1Type parm1, Parm2Type parm2) const = 0;
113  virtual ~UT_FunctorImpl2() {}
114 protected:
115  UT_FunctorImpl2() = default;
116  UT_FunctorImpl2(const UT_FunctorImpl2 &) = default;
117  UT_FunctorImpl2 &operator=(const UT_FunctorImpl2 &) = delete;
118 };
119 
120 // ===========================================================================
121 
122 // UT_FunctorHandlers are UT_FunctorImpl's that can automatically handle
123 // function pointers and other functors, thanks to the nature of template
124 // instantiation.
125 template <typename ParentFunctor, typename FunctorType>
127  : public UT_FunctorImpl<typename ParentFunctor::ReturnType>
128 {
129 public:
130  typedef typename ParentFunctor::ReturnType ReturnType;
131 
132  UT_FunctorHandler(const FunctorType &functor)
133  : myFunctor(functor)
134  {}
135 
136  // Our default copy constructor will call the copy constructor of our
137  // member variables. So, if our member variable is a UT_Functor, it
138  // will properly duplicate its UT_FunctorImpl.
140  { return new UT_FunctorHandler<ParentFunctor, FunctorType>(*this); }
141 
142  ReturnType operator()() const override
143  { return myFunctor(); }
144 
145 private:
146  FunctorType myFunctor;
147 };
148 
149 // ---------------------------------------------------------------------------
150 
151 template <typename ParentFunctor, typename FunctorType>
153  : public UT_FunctorImpl1<typename ParentFunctor::ReturnType,
154  typename ParentFunctor::Parm1Type>
155 {
156 public:
157  typedef typename ParentFunctor::ReturnType ReturnType;
158  typedef typename ParentFunctor::Parm1Type Parm1Type;
159  UT_FunctorHandler1(const FunctorType &functor)
160  : myFunctor(functor) {}
161 
164 
165  ReturnType operator()(Parm1Type parm1) const override
166  { return myFunctor(parm1); }
167 
168  int64 getMemoryUsage(bool inclusive) const override
169  {
170  int64 mem = inclusive ? sizeof(*this) : 0;
171  return mem;
172  }
173 
174 private:
175  FunctorType myFunctor;
176 };
177 
178 // ---------------------------------------------------------------------------
179 
180 template <typename ParentFunctor, typename FunctorType>
182  : public UT_FunctorImpl2<typename ParentFunctor::ReturnType,
183  typename ParentFunctor::Parm1Type,
184  typename ParentFunctor::Parm2Type>
185 {
186 public:
187  typedef typename ParentFunctor::ReturnType ReturnType;
188  typedef typename ParentFunctor::Parm1Type Parm1Type;
189  typedef typename ParentFunctor::Parm2Type Parm2Type;
190  UT_FunctorHandler2(const FunctorType &functor)
191  : myFunctor(functor) {}
192 
195 
196  ReturnType operator()(Parm1Type parm1, Parm2Type parm2) const override
197  { return myFunctor(parm1, parm2); }
198 
199 private:
200  FunctorType myFunctor;
201 };
202 
203 // ===========================================================================
204 
205 // These classes handle member function functors.
206 template <typename ParentFunctor, typename PointerToObj,
207  typename PointerToMemFn>
209  : public UT_FunctorImpl<typename ParentFunctor::ReturnType>
210 {
211 public:
212  typedef typename ParentFunctor::ReturnType ReturnType;
213 
214  UT_MemFunHandler(const PointerToObj &pointer_to_obj,
215  const PointerToMemFn pointer_to_mem_fn)
216  : myPointerToObj(pointer_to_obj), myPointerToMemFn(pointer_to_mem_fn)
217  {}
218 
220  { return new UT_MemFunHandler<ParentFunctor, PointerToObj,
221  PointerToMemFn>(*this); }
222 
223  ReturnType operator()() const override
224  { return ((*myPointerToObj).*myPointerToMemFn)(); }
225 
226 private:
227  PointerToObj myPointerToObj;
228  PointerToMemFn myPointerToMemFn;
229 };
230 
231 // ---------------------------------------------------------------------------
232 
233 template <typename ParentFunctor, typename PointerToObj,
234  typename PointerToMemFn>
236  : public UT_FunctorImpl1<typename ParentFunctor::ReturnType,
237  typename ParentFunctor::Parm1Type>
238 {
239 public:
240  typedef typename ParentFunctor::ReturnType ReturnType;
241  typedef typename ParentFunctor::Parm1Type Parm1Type;
242 
243  UT_MemFunHandler1(const PointerToObj &pointer_to_obj,
244  const PointerToMemFn pointer_to_mem_fn)
245  : myPointerToObj(pointer_to_obj), myPointerToMemFn(pointer_to_mem_fn)
246  {}
247 
249  { return new UT_MemFunHandler1<ParentFunctor, PointerToObj,
250  PointerToMemFn>(*this); }
251 
252  ReturnType operator()(Parm1Type parm1) const override
253  { return ((*myPointerToObj).*myPointerToMemFn)(parm1); }
254 
255  int64 getMemoryUsage(bool inclusive) const override
256  {
257  int64 mem = inclusive ? sizeof(*this) : 0;
258  return mem;
259  }
260 
261 private:
262  PointerToObj myPointerToObj;
263  PointerToMemFn myPointerToMemFn;
264 };
265 
266 // ---------------------------------------------------------------------------
267 
268 template <typename ParentFunctor, typename PointerToObj,
269  typename PointerToMemFn>
271  : public UT_FunctorImpl2<typename ParentFunctor::ReturnType,
272  typename ParentFunctor::Parm1Type,
273  typename ParentFunctor::Parm2Type>
274 {
275 public:
276  typedef typename ParentFunctor::ReturnType ReturnType;
277  typedef typename ParentFunctor::Parm1Type Parm1Type;
278  typedef typename ParentFunctor::Parm2Type Parm2Type;
279 
280  UT_MemFunHandler2(const PointerToObj &pointer_to_obj,
281  const PointerToMemFn pointer_to_mem_fn)
282  : myPointerToObj(pointer_to_obj), myPointerToMemFn(pointer_to_mem_fn)
283  {}
284 
286  { return new UT_MemFunHandler2<ParentFunctor, PointerToObj,
287  PointerToMemFn>(*this); }
288 
289  ReturnType operator()(Parm1Type parm1, Parm2Type parm2) const override
290  { return ((*myPointerToObj).*myPointerToMemFn)(parm1, parm2); }
291 
292 private:
293  PointerToObj myPointerToObj;
294  PointerToMemFn myPointerToMemFn;
295 };
296 
297 // ===========================================================================
298 
299 // These classes are the ones you actually use directly.
300 template <typename R>
302 {
303 public:
305  typedef R ReturnType;
306 
308 
309  // The functor takes ownership of the functor implementation.
310  explicit UT_Functor(UT_FunctorImpl<ReturnType> *functor_implementation)
311  : myFunctorImpl(functor_implementation)
312  {}
313 
315  {
316  myFunctorImpl.myFunctorImpl = src.myFunctorImpl.myFunctorImpl
317  ? src.myFunctorImpl.myFunctorImpl->clone() : nullptr;
318  }
319 
320  // This constructor lets us avoid using UT_FunctorHandler directly.
321  // This lets us do nice things like declare functors that take
322  // function pointers. The method template type does not need to
323  // be explicitly specified. When the constructor sees a UT_Functor
324  // created from a function pointer, it has no choice but to try the
325  // templated constructor.
326  template <typename FunctorType>
327  UT_Functor(FunctorType functor)
328  : myFunctorImpl(new UT_FunctorHandler<UT_Functor, FunctorType>(functor))
329  {}
330 
331  // Like the contructor that creates a UT_FunctorHandler, you don't
332  // need to explicitly specify the template parameters for this
333  // constuctor. The complier will figure it out.
334  template <typename PointerToObj, typename PointerToMemFn>
335  UT_Functor(const PointerToObj &pointer, PointerToMemFn method)
336  : myFunctorImpl(new UT_MemFunHandler<UT_Functor, PointerToObj,
337  PointerToMemFn>(pointer, method))
338  {}
339 
340  // The functor always owns the implementation.
342  {
343  delete myFunctorImpl.myFunctorImpl;
344  myFunctorImpl.myFunctorImpl = 0;
345  }
346 
347  // Clone the other functor's implementation on assignment.
348  UT_Functor &operator=(const UT_Functor &functor)
349  {
350  if (&functor != this)
351  {
352  delete myFunctorImpl.myFunctorImpl;
353  myFunctorImpl.myFunctorImpl = functor.myFunctorImpl.myFunctorImpl
354  ? functor.myFunctorImpl.myFunctorImpl->clone() : 0;
355  }
356  return *this;
357  }
358 
359  // Because we don't know what to return if the functor implementation
360  // hasn't been set, it's an error to evaluate the functor without
361  // an implementation. void return types are specialized in
362  // UT_Functor.C, though.
364  {
365  UT_ASSERT(myFunctorImpl.myFunctorImpl);
366  return (*myFunctorImpl.myFunctorImpl)();
367  }
368 
369  explicit operator bool() const noexcept { return isSet(); }
370 
371  // This method is useful to tell if a callback has ever been set.
372  bool isSet() const
373  { return myFunctorImpl.myFunctorImpl != 0; }
374 
375 private:
376  // This class is to work around a bug in MSVC where you can't
377  // override the copy constructor because of the templated constructor.
378  // This workaround is copied from the Loki port to MSVC.
379  class Helper
380  {
381  public:
382  Helper() : myFunctorImpl(0) {}
383 
384  // Clone the other functor's implementation in the copy constructor.
385  Helper(const Helper &helper)
386  { myFunctorImpl = helper.myFunctorImpl
387  ? helper.myFunctorImpl->clone() : 0; }
388 
389  explicit Helper(UT_FunctorImpl<ReturnType> *functor_implementation)
390  : myFunctorImpl(functor_implementation) {}
391 
392  template<typename U>
393  explicit Helper(U *ptr) : myFunctorImpl(ptr) {}
394 
395  UT_FunctorImpl<ReturnType> *myFunctorImpl;
396  };
397 
398  Helper myFunctorImpl;
399 };
400 
401 // ---------------------------------------------------------------------------
402 
403 template <typename R, typename P1>
405 {
406 public:
408  typedef R ReturnType;
409  typedef P1 Parm1Type;
410 
412 
413  explicit UT_Functor1(
414  UT_FunctorImpl1<ReturnType, Parm1Type> *functor_implementation)
415  : myFunctorImpl(functor_implementation)
416  {}
417 
418  template <typename FunctorType>
419  UT_Functor1(FunctorType functor)
420  : myFunctorImpl(new UT_FunctorHandler1<UT_Functor1, FunctorType>(functor))
421  {}
422 
423  template <typename PointerToObj, typename PointerToMemFn>
424  UT_Functor1(const PointerToObj &pointer, PointerToMemFn method)
425  : myFunctorImpl(new UT_MemFunHandler1<UT_Functor1, PointerToObj,
426  PointerToMemFn>(pointer, method))
427  {}
428 
430  {
431  myFunctorImpl.myFunctorImpl = src.myFunctorImpl.myFunctorImpl
432  ? src.myFunctorImpl.myFunctorImpl->clone() : nullptr;
433  }
434 
436  {
437  delete myFunctorImpl.myFunctorImpl;
438  myFunctorImpl.myFunctorImpl = 0;
439  }
440 
442  {
443  if (&functor != this)
444  {
445  delete myFunctorImpl.myFunctorImpl;
446  myFunctorImpl.myFunctorImpl = functor.myFunctorImpl.myFunctorImpl
447  ? functor.myFunctorImpl.myFunctorImpl->clone() : 0;
448  }
449  return *this;
450  }
451 
453  {
454  UT_ASSERT(myFunctorImpl.myFunctorImpl);
455  return (*myFunctorImpl.myFunctorImpl)(parm1);
456  }
457 
458  explicit operator bool() const noexcept {return isSet(); }
459 
460  bool isSet() const
461  { return myFunctorImpl.myFunctorImpl != 0; }
462 
463  int64 getMemoryUsage(bool inclusive) const
464  {
465  int64 mem = inclusive ? sizeof(*this) : 0;
466  if (myFunctorImpl.myFunctorImpl)
467  mem += myFunctorImpl.myFunctorImpl->getMemoryUsage(true);
468  return mem;
469  }
470 
471 private:
472  class Helper
473  {
474  public:
475  Helper() : myFunctorImpl(0) {}
476 
477  // Clone the other functor's implementation in the copy constructor.
478  Helper(const Helper &helper)
479  { myFunctorImpl = helper.myFunctorImpl
480  ? helper.myFunctorImpl->clone() : 0; }
481 
482  explicit Helper(
483  UT_FunctorImpl1<ReturnType, Parm1Type> *functor_implementation)
484  : myFunctorImpl(functor_implementation) {}
485 
486  template<typename U>
487  explicit Helper(U *ptr) : myFunctorImpl(ptr) {}
488 
490  };
491 
492  Helper myFunctorImpl;
493 };
494 
495 // ---------------------------------------------------------------------------
496 
497 template <typename R, typename P1, typename P2>
499 {
500 public:
502  typedef R ReturnType;
503  typedef P1 Parm1Type;
504  typedef P2 Parm2Type;
505 
507  explicit UT_Functor2(
509  : myFunctorImpl(functor_impl)
510  {}
511 
513  {
514  myFunctorImpl.myFunctorImpl = src.myFunctorImpl.myFunctorImpl
515  ? src.myFunctorImpl.myFunctorImpl->clone() : nullptr;
516  }
517 
518  template <typename FunctorType>
519  UT_Functor2(FunctorType functor)
520  : myFunctorImpl(new UT_FunctorHandler2<UT_Functor2, FunctorType>(functor))
521  {}
522 
523  template <typename PointerToObj, typename PointerToMemFn>
524  UT_Functor2(const PointerToObj &pointer, PointerToMemFn method)
525  : myFunctorImpl(new UT_MemFunHandler2<UT_Functor2, PointerToObj,
526  PointerToMemFn>(pointer, method))
527  {}
528 
530  {
531  delete myFunctorImpl.myFunctorImpl;
532  myFunctorImpl.myFunctorImpl = 0;
533  }
534 
536  {
537  if (&functor != this)
538  {
539  delete myFunctorImpl.myFunctorImpl;
540  myFunctorImpl.myFunctorImpl = functor.myFunctorImpl.myFunctorImpl
541  ? functor.myFunctorImpl.myFunctorImpl->clone() : nullptr;
542  }
543  return *this;
544  }
545 
547  {
548  UT_ASSERT(myFunctorImpl.myFunctorImpl);
549  return (*myFunctorImpl.myFunctorImpl)(parm1, parm2);
550  }
551 
552  explicit operator bool() const noexcept { return isSet(); }
553 
554  bool isSet() const
555  { return myFunctorImpl.myFunctorImpl != 0; }
556 
557 private:
558  class Helper
559  {
560  public:
561  Helper() : myFunctorImpl(0) {}
562 
563  // Clone the other functor's implementation in the copy constructor.
564  Helper(const Helper &helper)
565  { myFunctorImpl = helper.myFunctorImpl
566  ? helper.myFunctorImpl->clone() : 0; }
567 
568  explicit Helper(
570  : myFunctorImpl(functor_impl) {}
571 
572  template<typename U>
573  explicit Helper(U *ptr) : myFunctorImpl(ptr) {}
574 
576  };
577 
578  Helper myFunctorImpl;
579 };
580 
581 // ===========================================================================
582 
583 // This is a functor implementation class that stores an argument that
584 // passes that argument to a different functor.
585 template <typename Incoming>
586 class UT_BindFirstImpl : public UT_FunctorImpl<typename Incoming::ReturnType>
587 {
588 public:
589  typedef typename Incoming::ReturnType ReturnType;
590  typedef typename Incoming::Parm1Type BoundType;
591 
592  UT_BindFirstImpl(const Incoming &functor, BoundType bound_argument)
593  : myFunctor(functor), myBoundArgument(bound_argument)
594  {}
595 
597  { return new UT_BindFirstImpl(*this); }
598 
599  ReturnType operator()() const override
600  { return myFunctor(myBoundArgument); }
601 
602 private:
603  Incoming myFunctor;
604  BoundType myBoundArgument;
605 };
606 
607 // This function is used to convert one functor to another by binding
608 // the first argument to a fixed value.
609 template <typename Functor>
611 UT_BindFirst(const Functor &functor, typename Functor::Parm1Type bound_argument)
612 {
613  // For some reason, g++ wants to call the wrong UT_Functor constructor
614  // if we don't explicitly cast to the UT_FunctorImpl base class pointer.
617  new UT_BindFirstImpl<Functor>(functor, bound_argument));
618 }
619 
620 // ---------------------------------------------------------------------------
621 
622 template <typename Incoming>
623 class UT_BindFirstImpl1 : public UT_FunctorImpl1<typename Incoming::ReturnType,
624  typename Incoming::Parm2Type>
625 {
626 public:
627  typedef typename Incoming::ReturnType ReturnType;
628  typedef typename Incoming::Parm2Type Parm1Type;
629  typedef typename Incoming::Parm1Type BoundType;
630 
631  UT_BindFirstImpl1(const Incoming &functor, BoundType bound_argument)
632  : myFunctor(functor), myBoundArgument(bound_argument)
633  {}
634 
636  { return new UT_BindFirstImpl1(*this); }
637 
638  ReturnType operator()(Parm1Type parm1) const override
639  { return myFunctor(myBoundArgument, parm1); }
640 
641  int64 getMemoryUsage(bool inclusive) const override
642  {
643  int64 mem = inclusive ? sizeof(*this) : 0;
644  return mem;
645  }
646 
647 private:
648  Incoming myFunctor;
649  BoundType myBoundArgument;
650 };
651 
652 template <typename Functor>
654 UT_BindFirst1(const Functor &functor,
655  typename Functor::Parm1Type bound_argument)
656 {
657  typedef typename Functor::ReturnType ReturnType;
658  typedef typename Functor::Parm2Type Parm1Type;
659 
660  // For some reason, g++ wants to call the wrong UT_Functor constructor
661  // if we don't explicitly cast to the UT_FunctorImpl base class pointer.
664  new UT_BindFirstImpl1<Functor>(functor, bound_argument));
665 }
666 
667 // We need to include UT_Functor.C. Otherwise, it
668 // doesn't find the template specializations.
669 #if defined(WIN32) || defined(LINUX) || defined(MBSD)
670  #include "UT_Functor.C"
671 #endif
672 
673 #endif
Incoming::Parm1Type BoundType
Definition: UT_Functor.h:629
UT_FunctorImpl1 & operator=(const UT_FunctorImpl1 &)=delete
UT_FunctorImpl & operator=(const UT_FunctorImpl &)=delete
UT_MemFunHandler1(const PointerToObj &pointer_to_obj, const PointerToMemFn pointer_to_mem_fn)
Definition: UT_Functor.h:243
ParentFunctor::Parm2Type Parm2Type
Definition: UT_Functor.h:189
UT_Functor< typename Functor::ReturnType > UT_BindFirst(const Functor &functor, typename Functor::Parm1Type bound_argument)
Definition: UT_Functor.h:611
virtual ReturnType operator()(Parm1Type parm1) const =0
UT_FunctorHandler(const FunctorType &functor)
Definition: UT_Functor.h:132
virtual ReturnType operator()() const =0
ParentFunctor::ReturnType ReturnType
Definition: UT_Functor.h:240
UT_Functor(const this_type &src)
Definition: UT_Functor.h:314
UT_FunctorImpl< ReturnType > * clone() const override
Definition: UT_Functor.h:139
ParentFunctor::Parm1Type Parm1Type
Definition: UT_Functor.h:158
UT_Functor(FunctorType functor)
Definition: UT_Functor.h:327
UT_FunctorHandler1(const FunctorType &functor)
Definition: UT_Functor.h:159
ParentFunctor::Parm1Type Parm1Type
Definition: UT_Functor.h:277
UT_Functor(UT_FunctorImpl< ReturnType > *functor_implementation)
Definition: UT_Functor.h:310
UT_FunctorHandler2(const FunctorType &functor)
Definition: UT_Functor.h:190
UT_Functor(const PointerToObj &pointer, PointerToMemFn method)
Definition: UT_Functor.h:335
Incoming::Parm1Type BoundType
Definition: UT_Functor.h:590
UT_FunctorImpl2()=default
UT_FunctorImpl()=default
int64 getMemoryUsage(bool inclusive) const override
Definition: UT_Functor.h:255
Incoming::ReturnType ReturnType
Definition: UT_Functor.h:589
ReturnType operator()(Parm1Type parm1) const override
Definition: UT_Functor.h:252
UT_Functor1(FunctorType functor)
Definition: UT_Functor.h:419
virtual ~UT_FunctorImpl1()
Definition: UT_Functor.h:95
UT_FunctorImpl< ReturnType > * clone() const override
Definition: UT_Functor.h:219
virtual ReturnType operator()(Parm1Type parm1, Parm2Type parm2) const =0
UT_Functor1< typename Functor::ReturnType, typename Functor::Parm2Type > UT_BindFirst1(const Functor &functor, typename Functor::Parm1Type bound_argument)
Definition: UT_Functor.h:654
ParentFunctor::ReturnType ReturnType
Definition: UT_Functor.h:130
UT_FunctorImpl1< ReturnType, Parm1Type > * clone() const override
Definition: UT_Functor.h:248
ReturnType operator()(Parm1Type parm1, Parm2Type parm2) const
Definition: UT_Functor.h:546
UT_Functor1(UT_FunctorImpl1< ReturnType, Parm1Type > *functor_implementation)
Definition: UT_Functor.h:413
ReturnType operator()(Parm1Type parm1) const override
Definition: UT_Functor.h:638
int64 getMemoryUsage(bool inclusive) const override
Definition: UT_Functor.h:641
int64 getMemoryUsage(bool inclusive) const
Definition: UT_Functor.h:463
UT_FunctorImpl2< ReturnType, Parm1Type, Parm2Type > * clone() const override
Definition: UT_Functor.h:193
UT_MemFunHandler(const PointerToObj &pointer_to_obj, const PointerToMemFn pointer_to_mem_fn)
Definition: UT_Functor.h:214
ReturnType operator()() const override
Definition: UT_Functor.h:223
UT_Functor1(const this_type &src)
Definition: UT_Functor.h:429
ReturnType operator()(Parm1Type parm1) const override
Definition: UT_Functor.h:165
UT_FunctorImpl2< ReturnType, Parm1Type, Parm2Type > * clone() const override
Definition: UT_Functor.h:285
long long int64
Definition: SYS_Types.h:116
UT_Functor2(UT_FunctorImpl2< ReturnType, Parm1Type, Parm2Type > *functor_impl)
Definition: UT_Functor.h:507
ReturnType operator()(Parm1Type parm1, Parm2Type parm2) const override
Definition: UT_Functor.h:289
virtual int64 getMemoryUsage(bool inclusive) const =0
bool isSet() const
Definition: UT_Functor.h:372
Incoming::ReturnType ReturnType
Definition: UT_Functor.h:627
ReturnType operator()(Parm1Type parm1) const
Definition: UT_Functor.h:452
UT_FunctorImpl1< ReturnType, Parm1Type > * clone() const override
Definition: UT_Functor.h:635
ParentFunctor::Parm1Type Parm1Type
Definition: UT_Functor.h:241
UT_Functor1(const PointerToObj &pointer, PointerToMemFn method)
Definition: UT_Functor.h:424
bool isSet() const
Definition: UT_Functor.h:554
Incoming::Parm2Type Parm1Type
Definition: UT_Functor.h:628
virtual UT_FunctorImpl2< ReturnType, Parm1Type, Parm2Type > * clone() const =0
ParentFunctor::Parm2Type Parm2Type
Definition: UT_Functor.h:278
UT_BindFirstImpl1(const Incoming &functor, BoundType bound_argument)
Definition: UT_Functor.h:631
ParentFunctor::ReturnType ReturnType
Definition: UT_Functor.h:187
GLenum void ** pointer
Definition: glcorearb.h:810
UT_Functor2(FunctorType functor)
Definition: UT_Functor.h:519
virtual UT_FunctorImpl1< ReturnType, Parm1Type > * clone() const =0
ParentFunctor::ReturnType ReturnType
Definition: UT_Functor.h:276
UT_FunctorImpl2 & operator=(const UT_FunctorImpl2 &)=delete
int64 getMemoryUsage(bool inclusive) const override
Definition: UT_Functor.h:168
ReturnType operator()(Parm1Type parm1, Parm2Type parm2) const override
Definition: UT_Functor.h:196
UT_FunctorImpl1()=default
UT_Functor2 & operator=(const UT_Functor2 &functor)
Definition: UT_Functor.h:535
auto ptr(T p) -> const void *
Definition: format.h:2448
UT_Functor2(const this_type &src)
Definition: UT_Functor.h:512
virtual ~UT_FunctorImpl()
Definition: UT_Functor.h:76
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
UT_MemFunHandler2(const PointerToObj &pointer_to_obj, const PointerToMemFn pointer_to_mem_fn)
Definition: UT_Functor.h:280
UT_Functor & operator=(const UT_Functor &functor)
Definition: UT_Functor.h:348
ParentFunctor::ReturnType ReturnType
Definition: UT_Functor.h:157
UT_FunctorImpl< ReturnType > * clone() const override
Definition: UT_Functor.h:596
UT_Functor2(const PointerToObj &pointer, PointerToMemFn method)
Definition: UT_Functor.h:524
virtual ~UT_FunctorImpl2()
Definition: UT_Functor.h:113
UT_BindFirstImpl(const Incoming &functor, BoundType bound_argument)
Definition: UT_Functor.h:592
bool isSet() const
Definition: UT_Functor.h:460
ReturnType operator()() const override
Definition: UT_Functor.h:599
virtual UT_FunctorImpl< ReturnType > * clone() const =0
ParentFunctor::ReturnType ReturnType
Definition: UT_Functor.h:212
ReturnType operator()() const override
Definition: UT_Functor.h:142
ReturnType operator()() const
Definition: UT_Functor.h:363
UT_Functor1 & operator=(const UT_Functor1 &functor)
Definition: UT_Functor.h:441
ParentFunctor::Parm1Type Parm1Type
Definition: UT_Functor.h:188
GLenum src
Definition: glcorearb.h:1793
UT_FunctorImpl1< ReturnType, Parm1Type > * clone() const override
Definition: UT_Functor.h:162