object-value.inline.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef AFUN_OBJECT_VALUE_INLINE_H
  2. #define AFUN_OBJECT_VALUE_INLINE_H
  3. #include "object-value.h"
  4. namespace aFuncore {
  5. inline Object *Var::getData() {
  6. std::unique_lock<std::mutex> mutex{lock};
  7. return data;
  8. }
  9. inline void Var::setData(Object *data_) {
  10. std::unique_lock<std::mutex> mutex{lock};
  11. data = data_;
  12. }
  13. inline size_t VarSpace::getCount() {
  14. std::unique_lock<std::mutex> mutex{lock};
  15. return var.size();
  16. }
  17. inline Object *VarSpace::findObject(const std::string &name) {
  18. Var *ret = findVar(name);
  19. return ret ? ret->getData() : nullptr;
  20. }
  21. inline ProtectVarSpace::ProtectVarSpace(Inter &inter) : VarSpace(inter), is_protect{false} {
  22. }
  23. inline ProtectVarSpace::ProtectVarSpace(Environment &env_) : VarSpace(env_), is_protect{false} {
  24. }
  25. inline bool ProtectVarSpace::getProtect() const {
  26. return is_protect;
  27. }
  28. inline bool ProtectVarSpace::setProtect(bool protect) {
  29. bool ret = is_protect; is_protect = protect; return ret;
  30. }
  31. inline bool Function::isInfix() {
  32. return false;
  33. }
  34. inline bool CallBackVar::isCallBack(Inter &inter, Activation &activation) {
  35. return true;
  36. }
  37. };
  38. #endif //AFUN_OBJECT_VALUE_INLINE_H