getinfo.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010,2011 University of Bordeaux
  4. *
  5. * StarPU is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * StarPU is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. #ifndef SOCL_GETINFO_H
  17. #define SOCL_GETINFO_H
  18. #define INFO_CASE_EX2(var) if (param_value != NULL) { \
  19. if (param_value_size < sizeof(var)) \
  20. return CL_INVALID_VALUE; \
  21. memcpy(param_value, &var, sizeof(var)); \
  22. } \
  23. if (param_value_size_ret != NULL) \
  24. *param_value_size_ret = sizeof(var); \
  25. break;
  26. #define INFO_CASE(param, var) case param: \
  27. INFO_CASE_EX2(var)
  28. #define INFO_CASE_VALUE(param, type, value) case param: {\
  29. type tmp = (value);\
  30. INFO_CASE_EX2(tmp);\
  31. }
  32. //warning: var is a reference
  33. #define INFO_CASE_EX(param, var, size) case param: \
  34. if (param_value != NULL) { \
  35. if (param_value_size < size) \
  36. return CL_INVALID_VALUE; \
  37. memcpy(param_value, var, size); \
  38. } \
  39. if (param_value_size_ret != NULL) \
  40. *param_value_size_ret = size; \
  41. break;
  42. #endif /* SOCL_GETINFO_H */