06f8f2538c82ab1de04e85bce717b51bc3b48cba
[iotcloud.git] / src / js / iotjs / orig / tablestatus.js
1 class TableStatus extends Entry{
2         constructor(slot,_maxslots){
3                 super(slot);
4                 this.maxslots = _maxslots;
5         }
6         getMaxSlots(){
7                 return this.maxslots;
8         }
9         static decode(slot,bb){
10                 //bb is an object of the type bytebuffer See main.js file and its require section 
11                 //for more details
12                 if(!(bb instanceof ByteBuffer && slot instanceof Slot)){
13                         throw new Error('Argument Error: bb is not an instanceof Bytebuffer');
14                 }
15                 this.maxslots = bb.readByte();
16                 return new TableStatus(slot,this.maxslots);
17         }
18         encode(bb){
19                 bb.writeByte(Entry.TypeTableStatus);
20                 bb.writeInt8(this.maxslots);
21         }
22         getSize(){
23                 return 4+1;
24         }
25         getType(){
26                 return Entry.TypeTableStatus;
27         }
28         getcopy(s){
29                 if(!(s instanceof Slot)){
30                         throw new Error('Argument Error: s is not an instanceof Slot');
31                 }
32                 return new TableStatus(s,this.maxslots);
33         }
34 }