validate_arg.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Alec Jacobson <[email protected]>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_VALIDATE_ARG_H
  9. #define IGL_VALIDATE_ARG_H
  10. #include "../igl_inline.h"
  11. #include <mex.h>
  12. namespace igl
  13. {
  14. namespace matlab
  15. {
  16. /// Throw an error if arg i+1 is not a scalar
  17. ///
  18. /// @param[in] i index of current argument
  19. /// @param[in] nrhs total number of arguments
  20. /// @param[in] prhs pointer to arguments array
  21. /// @param[in] name name of current argument
  22. IGL_INLINE void validate_arg_scalar(
  23. const int i, const int nrhs, const mxArray * prhs[], const char * name);
  24. /// \overload
  25. /// \breif Throw an error if arg i+1 is not logical
  26. IGL_INLINE void validate_arg_logical(
  27. const int i, const int nrhs, const mxArray * prhs[], const char * name);
  28. /// \overload
  29. /// \breif Throw an error if arg i+1 is not char
  30. IGL_INLINE void validate_arg_char(
  31. const int i, const int nrhs, const mxArray * prhs[], const char * name);
  32. /// \overload
  33. /// \breif Throw an error if arg i+1 is not double
  34. IGL_INLINE void validate_arg_double(
  35. const int i, const int nrhs, const mxArray * prhs[], const char * name);
  36. /// \overload
  37. /// \breif Throw an error if arg i+1 is not a function handle
  38. IGL_INLINE void validate_arg_function_handle(
  39. const int i, const int nrhs, const mxArray * prhs[], const char * name);
  40. }
  41. }
  42. #ifndef IGL_STATIC_LIBRARY
  43. # include "validate_arg.cpp"
  44. #endif
  45. #endif