summaryrefslogtreecommitdiffstats
path: root/entities/JMXScriptEntity.h
blob: 0ee832d711006e537b1f77ebd9d9d1318b16d72f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
//  JMXScriptEntity.h
//  JMX
//
//  Created by xant on 11/16/10.
//  Copyright 2010 Dyne.org. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "JMXEntity.h"

@class JMXScript;
@class JMXScriptInputPin;
@class JMXScriptOutputPin;
@class JMXScriptPinWrapper;

@interface JMXScriptEntity : JMXEntity {
@protected
    NSString *code;
    JMXScript *jsContext;
    NSThread *executionThread;
    NSMutableSet *pinWrappers;
    JMXOutputPin *codeOutputPin;
}

@property (copy) NSString *code;
@property (retain) NSArray *arguments; // XXX - arguments need to be set before code
@property (readonly) JMXScript *jsContext;
@property (readonly) NSThread *executionThread;

- (BOOL)exec;
- (BOOL)exec:(NSString *)code;
- (void)resetContext;
- (void)hookEntity:(JMXEntity *)entity;

#ifdef __JMXV8__
- (JMXScriptPinWrapper *)wrapPin:(JMXPin *)pin withFunction:(v8::Persistent<v8::Function>)function;

- (JMXScriptInputPin *)registerJSInputPinWithLabel:(NSString *)label
                                        type:(JMXPinType)type
                                    function:(v8::Persistent<v8::Function>)function;
- (JMXScriptOutputPin *)registerJSOutputPinWithLabel:(NSString *)label
                                          type:(JMXPinType)type
                                      function:(v8::Persistent<v8::Function>)function;
#endif

@end