summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Wuerthwein <fkw@ucsd.edu>2009-02-11 23:59:12 +0000
committerFrank Wuerthwein <fkw@ucsd.edu>2009-02-11 23:59:12 +0000
commit095d686cabad40b847a608d1c8dd73ef6fd96e96 (patch)
tree232505008bb2586359ca76402ec30f8ef601e6f5
parentd5d3b82cd8819f0a22ff37cdb206655ef094e3ba (diff)
Add getDSbyName
-rw-r--r--src/lib/rrdFile.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/rrdFile.js b/src/lib/rrdFile.js
index f592643..aee1112 100644
--- a/src/lib/rrdFile.js
+++ b/src/lib/rrdFile.js
@@ -304,6 +304,15 @@ RRDHeader.prototype.getDS = function(idx) {
throw RangeError("DS idx ("+ idx +") out of range [0-" + this.ds_cnt +").");
}
}
+RRDHeader.prototype.getDSbyName = function(name) {
+ for (var idx=0; idx<this.ds_cnt; idx++) {
+ var ds=this.getDS(idx);
+ var ds_name=ds.getName()
+ if (ds_name==name)
+ return idx;
+ }
+ return undefined;
+}
RRDHeader.prototype.getNrRRAs = function() {
return this.rra_cnt;
@@ -346,6 +355,9 @@ function RRDFile(bf) {
this.getDS = function(idx) {
return this.rrd_header.getDS(idx);
}
+ this.getDSbyName = function(name) {
+ return this.rrd_header.getDSbyName(name);
+ }
this.getNrRRAs = function() {
return this.rrd_header.getNrRRAs();